From: NeilBrown <neilb@suse.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Theodore Ts'o <tytso@mit.edu>, Michal Hocko <mhocko@kernel.org>,
lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [ATTEND] many topics
Date: Mon, 23 Jan 2017 17:30:39 +1100 [thread overview]
Message-ID: <877f5me19s.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20170123060544.GA12833@bombadil.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 5049 bytes --]
On Mon, Jan 23 2017, Matthew Wilcox wrote:
> On Sun, Jan 22, 2017 at 03:45:01PM +1100, NeilBrown wrote:
>> On Sun, Jan 22 2017, Theodore Ts'o wrote:
>> > On Sat, Jan 21, 2017 at 11:11:41AM +1100, NeilBrown wrote:
>> >> What are the benefits of GFP_TEMPORARY? Presumably it doesn't guarantee
>> >> success any more than GFP_KERNEL does, but maybe it is slightly less
>> >> likely to fail, and somewhat less likely to block for a long time?? But
>> >> without some sort of promise, I wonder why anyone would use the
>> >> flag. Is there a promise? Or is it just "you can be nice to the MM
>> >> layer by setting this flag sometimes". ???
>> >
>> > My understanding is that the idea is to allow short-term use cases not
>> > to be mixed with long-term use cases --- in the Java world, to declare
>> > that a particular object will never be promoted from the "nursury"
>> > arena to the "tenured" arena, so that we don't end up with a situation
>> > where a page is used 90% for temporary objects, and 10% for a tenured
>> > object, such that later on we have a page which is 90% unused.
>> >
>> > Many of the existing users may in fact be for things like a temporary
>> > bounce buffer for I/O, where declaring this to the mm system could
>> > lead to less fragmented pages, but which would violate your proposed
>> > contract:
>
> I don't have a clear picture in my mind of when Java promotes objects
> from nursery to tenure ... which is not too different from my lack of
> understanding of what the MM layer considers "temporary" :-) Is it
> acceptable usage to allocate a SCSI command (guaranteed to be freed
> within 30 seconds) from the temporary area? Or should it only be used
> for allocations where the thread of control is not going to sleep between
> allocation and freeing?
>
>> You have used terms like "nursery" and "tenured" which don't really help
>> without definitions of those terms.
>> How about
>>
>> GFP_TEMPORARY should be used when the memory allocated will either be
>> freed, or will be placed in a reclaimable cache, after some sequence
>> of events which is time-limited. i.e. there must be no indefinite
>> wait on the path from allocation to freeing-or-caching.
>> The memory will typically be allocated from a region dedicated to
>> GFP_TEMPORARY allocations, thus ensuring that this region does not
>> become fragmented. Consequently, the delay imposed on GFP_TEMPORARY
>> allocations is likely to be less than for non-TEMPORARY allocations
>> when memory pressure is high.
>
> I think you're overcomplicating your proposed contract by allowing for
> the "adding to a reclaimable cache" case. If that will happen, the
> code should be using GFP_RECLAIMABLE, not GFP_TEMPORARY as a matter of
> good documentation. And to allow the definitions to differ in future.
> Maybe they will always be the same bit pattern, but the code should
> distinguish the two cases (obviously there is no problem with allocating
> memory with GFP_RECLAIMABLE, then deciding you didn't need it after all
> and freeing it).
I only included the "Reclaimable cache" possibility because Michal said:
I guess the original intention was to use this flag for allocations
which will be either freed shortly or they are reclaimable.
>
>> ??
>> I think that for this definition to work, we would need to make it "a
>> movable cache", meaning that any item can be either freed or
>> re-allocated (presumably to a "tenured" location). I don't think we
>> currently have that concept for slabs do we? That implies that this
>> flag would only apply to whole-page allocations (which was part of the
>> original question). We could presumably add movability to
>> slab-shrinkers if these seemed like a good idea.
>
> Funnily, Christoph Lameter and I are working on just such a proposal.
> He put it up as a topic discussion at the LCA Kernel Miniconf, and I've
> done a proof of concept implementation for radix tree nodes. It needs
> changes to the radix tree API to make it work, so it's not published yet,
> but it's a useful proof of concept for things which can probably work
> and be more effective, like the dentry & inode caches.
Awesome!
>
>> I think that it would also make sense to require that the path from
>> allocation to freeing (or caching) of GFP_TEMPORARY allocation must not
>> wait for a non-TEMPORARY allocation, as that becomes an indefinite wait.
>
> ... can it even wait for *another* TEMPORARY allocation? I really think
> this discussion needs to take place in a room with more people present
> so we can get misunderstandings hammered out and general acceptance of
> the consensus.
I suspect you are right, but throwing around some thoughts in advance,
to spark new ideas, can't hurt? I hate going to meetings where the
agenda has a topic, but no background discussion. It means that I have
to do all my thinking on my feet (not that I'll be at this meeting).
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-01-23 6:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 5:49 [ATTEND] many topics Matthew Wilcox
2017-01-18 10:13 ` [Lsf-pc] " Jan Kara
2017-01-18 11:26 ` willy
2017-01-18 13:32 ` Michal Hocko
2017-01-19 11:05 ` willy
2017-01-19 11:33 ` Michal Hocko
2017-01-19 11:52 ` willy
2017-01-19 12:11 ` Michal Hocko
2017-01-21 0:11 ` NeilBrown
2017-01-21 13:16 ` Theodore Ts'o
2017-01-22 4:45 ` NeilBrown
2017-01-23 6:05 ` Matthew Wilcox
2017-01-23 6:30 ` NeilBrown [this message]
2017-01-23 6:35 ` Matthew Wilcox
2017-01-23 17:09 ` Theodore Ts'o
2017-01-23 19:34 ` NeilBrown
2017-01-25 14:36 ` Vlastimil Babka
2017-01-25 20:36 ` Matthew Wilcox
2017-01-25 21:15 ` Vlastimil Babka
2017-01-25 23:19 ` NeilBrown
2017-01-26 8:56 ` Michal Hocko
2017-01-26 21:20 ` NeilBrown
2017-01-27 13:12 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877f5me19s.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=mhocko@kernel.org \
--cc=tytso@mit.edu \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).