From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Paul Jackson <pj@sgi.com>
Cc: rohit.seth@intel.com, akpm@osdl.org, torvalds@osdl.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH]: Cleanup of __alloc_pages
Date: Tue, 08 Nov 2005 17:00:27 +1100 [thread overview]
Message-ID: <43703EFB.1010103@yahoo.com.au> (raw)
In-Reply-To: <20051107214420.6d0f6ec4.pj@sgi.com>
Paul Jackson wrote:
> Nick wrote:
>
>>The compiler will constant fold this out if it is halfway smart.
>
>
> How could that happen - when get_page_from_freelist() is called twice,
> once with skip_cpuset_chk == 0 and once with skip_cpuset_chk == 1?
>
Because it is on the other side of an &&, which evaulates to a
constant zero when !CONFIG_CPUSETS.
>
>
>>+#define ALLOC_WATERMARKS 0x01 /* check watermarks */
>>+#define ALLOC_HARDER 0x02 /* try to alloc harder */
>>+#define ALLOC_HIGH 0x04 /* __GFP_HIGH set */
>>+#define ALLOC_CPUSET 0x08 /* check for correct cpuset */
>
>
> Names - bless you.
>
> If these names were in a header, then calls to zone_watermark_ok()
> from mm/vmscan.c could use them too?
>
>
>
>>+ * reclaim. Now things get more complex, so st up alloc_flags according
>
>
> Typo: s/st/set/
>
>
> At first glance, I think you've expressed the cpuset flags correctly.
> Well, correctly maintained their current meaning. Read on, and you
> will see that I think that is not right.
>
> I'm just reading the raw patch, so likely I missed something here.
> But it seems to me that zone_watermark_ok() is called from __alloc_pages()
> only if the ALLOC_WATERMARKS flag is set, and it seems that the two
> alloc_flags values ALLOC_HARDER and ALLOC_HIGH are only of use if
> zone_watermark() is called. So what use is it setting ALLOC_HARDER
> or ALLOC_HIGH if ALLOC_WATERMARKS is not set? If the get_page_from_freelist()
> check:
> if (alloc_flags & ALLOC_WATERMARKS)
> was instead:
> if (alloc_flags & ALLOC_WATERMARKS|ALLOC_HARDER|ALLOC_HIGH)
> then this would make more sense to me. Or changing ALLOC_WATERMARKS
> to ALLOC_EASY, and make it behave similarly to the HARDER & HIGH flags.
> Or maybe if the initialization of alloc_flags:
>
>>+ alloc_flags = 0;
>
> was instead:
> + alloc_flags = ALLOC_WATERMARKS;
>
Yep that's a bug. Thanks. Maybe instead we should have a specific
flag for ALLOC_NO_WATERMARKS because that is the unusual case. The
use of the flag there would be a good annotation too.
> The cpuset check in the 'ignoring mins' code shortly after this for the
> PF_MEMALLOC or TIF_MEMDIE cases seems bogus. This is the case where we
> should be most willing to use memory, regardless of where we find it.
> That cpuset check should be removed.
>
OK that would be fine, but let's do that (and your suggested possible
consolidation of ALLOC_CPUSET) in another patch?
> My current inclination - check cpusets in the WATERMARKS or HARDER
> or (HIGH && wait) cases, but ignore cpusets in the (HIGH && !wait) or
> 'ignoring mins' cases. Can "HIGH && wait" even happen ?? Are
Yes there is nothing preventing it.
> allocations either GFP_ATOMIC (aka GFP_HIGH) or (exclusive or)
> GFP_WAIT, never both? Perhaps GFP_HIGH should be permanently
> deleted (another cleanup) in favor of the more popular and expressive
> GFP_ATOMIC, and __GFP_WAIT retired, in favor of !GFP_ATOMIC.
>
Having __GFP_HIGH as its own flag gives some more flexibility. I
don't think it has a downside?
> However, I appreciate your preference to separate cleanup from semantic
> change. Perhaps this means leaving the ALLOC_CPUSET flag in your
> cleanup patch, then one of us following on top of that with a patch to
> simplify and fix the cpuset invocation semantics and a second cleanup
> patch to remove ALLOC_CPUSET as a separate flag.
>
That would be good. I'll send off a fresh patch with the
ALLOC_WATERMARKS fixed after Rohit gets around to looking over
it.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2005-11-08 6:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-08 1:43 Rohit, Seth
2005-11-08 1:53 ` Andrew Morton
2005-11-08 2:16 ` Rohit Seth
2005-11-08 2:44 ` Andrew Morton
2005-11-08 3:47 ` Nick Piggin
2005-11-08 5:44 ` Paul Jackson
2005-11-08 6:00 ` Nick Piggin [this message]
2005-11-08 6:22 ` Paul Jackson
2005-11-08 18:17 ` Rohit Seth
2005-11-08 19:54 ` Paul Jackson
2005-11-09 2:52 ` Nick Piggin
2005-11-13 5:09 ` Paul Jackson
2005-11-13 5:14 ` Paul Jackson
2005-11-13 7:00 ` Nathan Scott
2005-11-13 7:12 ` Andrew Morton
2005-11-13 7:47 ` Paul Jackson
2005-11-08 3:07 ` Paul Jackson
2005-11-08 5:31 ` Nick Piggin
2005-11-09 0:17 ` Paul Jackson
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=43703EFB.1010103@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pj@sgi.com \
--cc=rohit.seth@intel.com \
--cc=torvalds@osdl.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