[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eef914fb-c3c4-effa-5bd8-81ee2495a2f9@suse.cz>
Date: Tue, 31 Aug 2021 19:40:36 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Matthew Wilcox <willy@...radead.org>,
Johannes Weiner <hannes@...xchg.org>
Cc: "Darrick J. Wong" <djwong@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [GIT PULL] Memory folios for v5.15
On 8/30/21 23:38, Matthew Wilcox wrote:
> I think something that might actually help is if we added a pair of new
> GFP flags, __GFP_FAST and __GFP_DENSE. Dense allocations are those which
> are expected to live for a long time, and so the page allocator should
> try to group them with other dense allocations. Slab and page tables
> should use DENSE, along with things like superblocks, or fs bitmaps where
> the speed of allocation is almost unimportant, but attempting to keep
> them out of the way of other allocations is useful. Fast allocations
> are for allocations which should not live for very long. The speed of
> allocation dominates, and it's OK if the allocation gets in the way of
> defragmentation for a while.
Note we used to have GFP_TEMPORARY, but it didn't really work out:
https://lwn.net/Articles/732107/
> An example of another allocator that could care about DENSE vs FAST
> would be vmalloc. Today, it does:
>
> if (array_size > PAGE_SIZE) {
> area->pages = __vmalloc_node(array_size, 1, nested_gfp, node,
> area->caller);
> } else {
> area->pages = kmalloc_node(array_size, nested_gfp, node);
> }
>
> That's actually pretty bad; if you have, say, a 768kB vmalloc space,
> you need a 12kB array. We currently allocate 16kB for the array, when we
> could use alloc_pages_exact() to free the 4kB we're never going to use.
> If this is GFP_DENSE, we know it's a long-lived allocation and we can
> let somebody else use the extra 4kB. If it's not, it's probably not
> worth bothering with.
>
Powered by blists - more mailing lists