Received: by 10.223.185.116 with SMTP id b49csp1040000wrg; Fri, 16 Feb 2018 11:17:38 -0800 (PST) X-Google-Smtp-Source: AH8x226hLKvO8rdi2JsaFnYuHSQHY0vuu2DDIytP+qd1tZeK9Qh2C/t+HDSdn8ooW8+YFbDYA2Ha X-Received: by 10.99.127.29 with SMTP id a29mr5859095pgd.451.1518808658553; Fri, 16 Feb 2018 11:17:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808658; cv=none; d=google.com; s=arc-20160816; b=UEPYRNE67xqeaWqqwWP7RHCwe4/0N0ygKc9yNg64jUpny7edDcvJXnpHnEGY6Udu9Y qinAm0eTIlKWeyDS8xdwzc9VY+VwTMHzRDEeR1Es6AmAg2rgQVhTjMmcgT0eVepaHu6R q6RideD/Zd9W5O4tHJrYuKX91PDykUaZOyDWJUxYoPIFfTYt0PFrr33Xljji+dWRtHWL 1i6heiBBeQT5d7ABJuHa5g3O6jyduZH2AuwIxOf10AtwIv9GTnNXDtDGVD1K/+LEwhkd h5QSZh1faOuF3sDoUUC2DeViPjUDN6x/3RNtMmaZFg/vwUMnKO7Bz1OB1+hTZ7b4I8pt ERAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=06HUGzgGM1K/UcpiGjS+leOtE/TADEme6wDnxLVnZ8w=; b=0Rrc+TLjmP92EdYpVgUq2rXVV9FEJ9Lpi3T8QshYqVOprVArq/lrvKywsV0HF+WHZi 7v69Bhiw1cwClPwnAAVExTg/ZYcCfYLX/glLAa2vwZt8PKkEyKOtr5n/73oYu4j4ghDt t3pzMCbEQqDQnYzFV800iT3I46ycqagKlcZplcbg5BZsfqF/fToOYISxibK/zcZr9PvJ utsei6vAKphaKV3te3JR9aLeLxDHSdU/sMk1g4qx1SgKK1Z5PkbQRGApVa07neX3glkt L6yoi/29T6UUct+YPvIBNTyq8WdplJKo8ZF/UFGMKJINxGCBHDFrQS2yxRoT1gjozruU idZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o15si4671423pgc.48.2018.02.16.11.17.24; Fri, 16 Feb 2018 11:17:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758464AbeBPQIc (ORCPT + 99 others); Fri, 16 Feb 2018 11:08:32 -0500 Received: from resqmta-ch2-07v.sys.comcast.net ([69.252.207.39]:58370 "EHLO resqmta-ch2-07v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753022AbeBPQIb (ORCPT ); Fri, 16 Feb 2018 11:08:31 -0500 Received: from resomta-ch2-10v.sys.comcast.net ([69.252.207.106]) by resqmta-ch2-07v.sys.comcast.net with ESMTP id miYoeI3E6qoE3miYoeX51j; Fri, 16 Feb 2018 16:08:30 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-10v.sys.comcast.net with SMTP id miYmeOZKnxVSTmiYnecPxy; Fri, 16 Feb 2018 16:08:30 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 9E73E116016D; Fri, 16 Feb 2018 10:08:28 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 9A5D5116013F; Fri, 16 Feb 2018 10:08:28 -0600 (CST) Date: Fri, 16 Feb 2018 10:08:28 -0600 (CST) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Matthew Wilcox cc: Michal Hocko , David Rientjes , Andrew Morton , Jonathan Corbet , Vlastimil Babka , Mel Gorman , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org Subject: Re: [patch 1/2] mm, page_alloc: extend kernelcore and movablecore for percent In-Reply-To: <20180216160116.GA24395@bombadil.infradead.org> Message-ID: References: <20180214095911.GB28460@dhcp22.suse.cz> <20180215144525.GG7275@dhcp22.suse.cz> <20180215151129.GB12360@bombadil.infradead.org> <20180215204817.GB22948@bombadil.infradead.org> <20180216160116.GA24395@bombadil.infradead.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfA1HohpbdGwXDNuubu8knmIZcSTwByIihj4g2ceJeD50UtW0F+Cd9HpAC+ZYsJ8BZEkJxUYU9flHK6pR0GrOBlX/tAJA3JvJspfNDDFkG1bWLyn633lD lXdq8xHmXnPtoaNDZ1WCoJyHT9pPxKTw93fzP5j6R/AwNw4MkCvoL3Je8XggKHe+qd5l3q0pltzGAvjvkAqN2gXT28MQbDYd3bWxlWicmbbKLQxALVRTXq5+ PnMSxNYOxtmZmgVkjZA9kMuYoLUHu/flwXG3Yc8sav7F/NATy8V+RhfFh4hXwZRIqG7k2DGk7NPPY7B/nrT24Wnixnz7mgq/QbnSKS2pRhqgEeB7lhQAtgIS Y6ELE9aat8xjIIAxJfHYMEGpmSSTyJbZ7JRIk7RAKcJK8VfpfWuURpXBdk4MxF/q24OI477GrKak1ahxxGKY6/Q0xRTUgw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 16 Feb 2018, Matthew Wilcox wrote: > On Fri, Feb 16, 2018 at 09:44:25AM -0600, Christopher Lameter wrote: > > On Thu, 15 Feb 2018, Matthew Wilcox wrote: > > > What I was proposing was an intermediate page allocator where slab would > > > request 2MB for its own uses all at once, then allocate pages from that to > > > individual slabs, so allocating a kmalloc-32 object and a dentry object > > > would result in 510 pages of memory still being available for any slab > > > that needed it. > > > > Well thats not really going to work since you would be mixing objects of > > different sizes which may present more fragmentation problems within the > > 2M later if they are freed and more objects are allocated. > > I don't understand this response. I'm not suggesting mixing objects > of different sizes within the same page. The vast majority of slabs > use order-0 pages, a few use order-1 pages and larger sizes are almost > unheard of. I'm suggesting the slab have it's own private arena of pages > that it uses for allocating pages to slabs; when an entire page comes > free in a slab, it is returned to the arena. When the arena is empty, > slab requests another arena from the page allocator. This just shifts the fragmentation problem because the 2M page cannot be released until all 4k or 8k pages within that 2M page are freed. How is that different from the page allocator which cannot coalesce an 2M page until all fragments have been released? The kernelcore already does something similar by limiting the general unmovable allocs to a section of memory. > If you're concerned about order-0 allocations fragmenting the arena > for order-1 slabs, then we could have separate arenas for order-0 and > order-1. But there should be no more fragmentation caused by sticking > within an arena for page allocations than there would be by spreading > slab allocations across all memory. We avoid large frames at this point but they are beneficial to pack objects tighter and also increase performance. Maybe what we should do is raise the lowest allocation size instead and allocate 2^x groups of pages to certain purposes? I.e. have a base allocation size of 16k and if the alloc was a page cache page then use the remainder for the neigboring pages. Similar things could be done for the page allocator. Raising the minimum allocation size may allow us to reduce the sizes necessary to be allocated at the price of loosing some memory. On large systems this may not matter much.