linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Michal Hocko <mhocko@suse.cz>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: mm: page_alloc: avoid marking zones full prematurely after zone_reclaim()
Date: Tue, 2 Apr 2013 11:37:13 +0100	[thread overview]
Message-ID: <20130402103713.GD32241@suse.de> (raw)
In-Reply-To: <20130401111324.GY18466@mwanda>

On Mon, Apr 01, 2013 at 02:13:24PM +0300, Dan Carpenter wrote:
> I still don't understand the code in gfp_to_alloc_flags().
> 
> 	int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;
> 
> ORing with zero is odd.
> 

Thanks Dan for the report and thanks Michal for fixing it. I was offline
for last week which lead to my tardy response.

The odditiy is that ALLOC_WMARK_MIN is not treated as a flag but as an
offset within the zone->wmark so it starts as 0. It could have been
written as

	int alloc_flags = ALLOC_CPUSET;

but then it would be easy to forget that in this path we are using the
MIN watermark.

The "flag" is used as an offset because it eliminated a number of
branches in the page allocator and was a micro-optimisation at the time.

-- 
Mel Gorman
SUSE Labs

--
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>

      parent reply	other threads:[~2013-04-02 10:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27  6:01 mm: page_alloc: avoid marking zones full prematurely after zone_reclaim() Dan Carpenter
2013-03-27 16:55 ` Michal Hocko
2013-03-27 17:13   ` Michal Hocko
2013-04-01 11:13   ` Dan Carpenter
2013-04-02  9:55     ` Michal Hocko
2013-04-02 10:37     ` Mel Gorman [this message]

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=20130402103713.GD32241@suse.de \
    --to=mgorman@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    /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).