From 23ff0615b0bff00f800b247c916f1237e1409f8d Mon Sep 17 00:00:00 2001 From: marino Date: Thu, 30 Apr 2015 19:34:46 +0000 Subject: www/squid: Add MAP_NOSYNC flay to mmap call This is the same technique used by PostgreSQL to prevent dirty pages from flushing prematurely (performance hit). In any case, it can't hurt and it's been used in production for 18 months. Timp87 provided the 3.5 version of squid; the port is still unmaintained. PR: 198920 Submitted by: emz (norma.perm.ru) concurred: timp87 (gmail) --- www/squid/Makefile | 1 + www/squid/files/patch-src_DiskIO_Mmapped_MmappedFile.cc | 11 +++++++++++ www/squid/files/patch-src_ipc_mem_Segment.cc | 11 +++++++++++ 3 files changed, 23 insertions(+) create mode 100644 www/squid/files/patch-src_DiskIO_Mmapped_MmappedFile.cc create mode 100644 www/squid/files/patch-src_ipc_mem_Segment.cc diff --git a/www/squid/Makefile b/www/squid/Makefile index 21a38b2e21dd..65ed42cdbe27 100644 --- a/www/squid/Makefile +++ b/www/squid/Makefile @@ -2,6 +2,7 @@ PORTNAME= squid PORTVERSION= 3.5.3 +PORTREVISION= 1 CATEGORIES= www ipv6 MASTER_SITES= http://www.squid-cache.org/Versions/v3/${PORTVERSION:R}/ \ http://www2.us.squid-cache.org/Versions/v3/${PORTVERSION:R}/ \ diff --git a/www/squid/files/patch-src_DiskIO_Mmapped_MmappedFile.cc b/www/squid/files/patch-src_DiskIO_Mmapped_MmappedFile.cc new file mode 100644 index 000000000000..0c0fb850ada5 --- /dev/null +++ b/www/squid/files/patch-src_DiskIO_Mmapped_MmappedFile.cc @@ -0,0 +1,11 @@ +--- src/DiskIO/Mmapped/MmappedFile.cc.orig 2015-04-15 10:39:56.146312000 +0300 ++++ src/DiskIO/Mmapped/MmappedFile.cc 2015-04-15 10:40:53.487834000 +0300 +@@ -235,7 +235,7 @@ + static const int pageSize = getpagesize(); + delta = offset % pageSize; + +- buf = mmap(NULL, length + delta, prot, flags, fd, offset - delta); ++ buf = mmap(NULL, length + delta, prot, flags | MAP_NOSYNC, fd, offset - delta); + + if (buf == MAP_FAILED) { + const int errNo = errno; diff --git a/www/squid/files/patch-src_ipc_mem_Segment.cc b/www/squid/files/patch-src_ipc_mem_Segment.cc new file mode 100644 index 000000000000..adef66211481 --- /dev/null +++ b/www/squid/files/patch-src_ipc_mem_Segment.cc @@ -0,0 +1,11 @@ +--- src/ipc/mem/Segment.cc.orig 2015-04-15 10:38:29.724278000 +0300 ++++ src/ipc/mem/Segment.cc 2015-04-15 10:39:37.130756000 +0300 +@@ -150,7 +150,7 @@ + assert(theSize == static_cast(static_cast(theSize))); + + void *const p = +- mmap(NULL, theSize, PROT_READ | PROT_WRITE, MAP_SHARED, theFD, 0); ++ mmap(NULL, theSize, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NOSYNC, theFD, 0); + if (p == MAP_FAILED) { + debugs(54, 5, HERE << "mmap " << theName << ": " << xstrerror()); + fatalf("Ipc::Mem::Segment::attach failed to mmap(%s): %s\n", -- cgit