From: Alex Rousskov Date: Wed, 13 Apr 2011 19:30:46 +0000 (-0600) Subject: Increased page size to 32KB so that most typical responses would fit X-Git-Tag: take06~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=722614562392daafb3e938a8c8827c8920f0b9f7;p=thirdparty%2Fsquid.git Increased page size to 32KB so that most typical responses would fit until we support multi-page caching. Made cumulative page size limit configurable via cache_mem. Implemented Ipc::Mem::Limit(). --- diff --git a/src/ipc/mem/Pages.cc b/src/ipc/mem/Pages.cc index 4427481225..34889043af 100644 --- a/src/ipc/mem/Pages.cc +++ b/src/ipc/mem/Pages.cc @@ -19,18 +19,18 @@ static const String PagePoolId = "squid-page-pool"; static Ipc::Mem::PagePool *ThePagePool = 0; -// XXX: make configurable +// TODO: make configurable to avoid waste when mem-cached objects are small/big size_t Ipc::Mem::PageSize() { - return 16*1024; + return 32*1024; } void Ipc::Mem::Init() { Must(!ThePagePool); - // XXX: pool capacity and page size should be configurable/meaningful - ThePagePool = new PagePool(PagePoolId, 1024, PageSize()); + const size_t capacity = Limit() / PageSize(); + ThePagePool = new PagePool(PagePoolId, capacity, PageSize()); } void @@ -44,8 +44,7 @@ Ipc::Mem::Attach() bool Ipc::Mem::GetPage(PageId &page) { - Must(ThePagePool); - return ThePagePool->get(page); + return ThePagePool ? ThePagePool->get(page) : false; } void @@ -61,3 +60,15 @@ Ipc::Mem::PagePointer(const PageId &page) Must(ThePagePool); return ThePagePool->pagePointer(page); } + +size_t +Ipc::Mem::Limit() +{ + // TODO: adjust cache_mem description to say that in SMP mode, + // in-transit objects are not allocated using cache_mem. Eventually, + // they should not use cache_mem even if shared memory is not used: + // in-transit objects have nothing to do with caching. + return Config.memMaxSize; +} + +// TODO: Implement size_t Ipc::Mem::Level()