linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>, Mel Gorman <mgorman@suse.de>,
	Mark <markk@clara.co.uk>, Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: Re: [RFC PATCH] mm: CONFIG_NR_ZONES_EXTENDED
Date: Sat, 6 Feb 2016 22:10:15 -0800	[thread overview]
Message-ID: <CAPcyv4jsLBsPfojMabS-B_kEu+gXM6xVQG5Aeo-7SUyM3rgfCw@mail.gmail.com> (raw)
In-Reply-To: <20160201214213.2bdf9b4e.akpm@linux-foundation.org>

On Mon, Feb 1, 2016 at 9:42 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 27 Jan 2016 22:19:14 -0800 Dan Williams <dan.j.williams@intel.com> wrote:

>>  #define GFP_ZONE_TABLE ( \
>> -     (ZONE_NORMAL << 0 * ZONES_SHIFT)                                      \
>> -     | (OPT_ZONE_DMA << ___GFP_DMA * ZONES_SHIFT)                          \
>> -     | (OPT_ZONE_HIGHMEM << ___GFP_HIGHMEM * ZONES_SHIFT)                  \
>> -     | (OPT_ZONE_DMA32 << ___GFP_DMA32 * ZONES_SHIFT)                      \
>> -     | (ZONE_NORMAL << ___GFP_MOVABLE * ZONES_SHIFT)                       \
>> -     | (OPT_ZONE_DMA << (___GFP_MOVABLE | ___GFP_DMA) * ZONES_SHIFT)       \
>> -     | (ZONE_MOVABLE << (___GFP_MOVABLE | ___GFP_HIGHMEM) * ZONES_SHIFT)   \
>> -     | (OPT_ZONE_DMA32 << (___GFP_MOVABLE | ___GFP_DMA32) * ZONES_SHIFT)   \
>> +     (ZONE_NORMAL << 0 * GFP_ZONES_SHIFT)                                    \
>> +     | (OPT_ZONE_DMA << ___GFP_DMA * GFP_ZONES_SHIFT)                        \
>> +     | (OPT_ZONE_HIGHMEM << ___GFP_HIGHMEM * GFP_ZONES_SHIFT)                \
>> +     | (OPT_ZONE_DMA32 << ___GFP_DMA32 * GFP_ZONES_SHIFT)                    \
>> +     | (ZONE_NORMAL << ___GFP_MOVABLE * GFP_ZONES_SHIFT)                     \
>> +     | (OPT_ZONE_DMA << (___GFP_MOVABLE | ___GFP_DMA) * GFP_ZONES_SHIFT)     \
>> +     | (ZONE_MOVABLE << (___GFP_MOVABLE | ___GFP_HIGHMEM) * GFP_ZONES_SHIFT) \
>> +     | (OPT_ZONE_DMA32 << (___GFP_MOVABLE | ___GFP_DMA32) * GFP_ZONES_SHIFT) \
>>  )
>
> Geeze.  Congrats on decrypting this stuff.  I hope.  Do you think it's
> possible to comprehensibly document it all for the next poor soul who
> ventures into it?
>

It is documented, just not included in the diff context.  At least the
existing documentation was enough for me to decipher that my changes
were doing the right thing:

/*
 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long
 * and there are 16 of them to cover all possible combinations of
 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM.
 *
 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
 * But GFP_MOVABLE is not only a zone specifier but also an allocation
 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid.
 * Only 1 bit of the lowest 3 bits (DMA,DMA32,HIGHMEM) can be set to "1".
 *
 *       bit       result
 *       =================
 *       0x0    => NORMAL
 *       0x1    => DMA or NORMAL
 *       0x2    => HIGHMEM or NORMAL
 *       0x3    => BAD (DMA+HIGHMEM)
 *       0x4    => DMA32 or DMA or NORMAL
 *       0x5    => BAD (DMA+DMA32)
 *       0x6    => BAD (HIGHMEM+DMA32)
 *       0x7    => BAD (HIGHMEM+DMA32+DMA)
 *       0x8    => NORMAL (MOVABLE+0)
 *       0x9    => DMA or NORMAL (MOVABLE+DMA)
 *       0xa    => MOVABLE (Movable is valid only if HIGHMEM is set too)
 *       0xb    => BAD (MOVABLE+HIGHMEM+DMA)
 *       0xc    => DMA32 (MOVABLE+DMA32)
 *       0xd    => BAD (MOVABLE+DMA32+DMA)
 *       0xe    => BAD (MOVABLE+DMA32+HIGHMEM)
 *       0xf    => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
 *
 * GFP_ZONES_SHIFT must be <= 2 on 32 bit platforms.
 */

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

  reply	other threads:[~2016-02-07  6:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28  6:19 Dan Williams
2016-02-02  5:42 ` Andrew Morton
2016-02-07  6:10   ` Dan Williams [this message]
2016-02-29 12:33   ` Vlastimil Babka
2016-02-29 17:55     ` Dan Williams
2016-03-01  0:06       ` Vlastimil Babka
2016-03-01  2:06         ` Dan Williams
2016-03-01  8:31           ` Vlastimil Babka
2016-03-01 23:43             ` Dan Williams
2016-03-02  8:10               ` Vlastimil Babka

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=CAPcyv4jsLBsPfojMabS-B_kEu+gXM6xVQG5Aeo-7SUyM3rgfCw@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=markk@clara.co.uk \
    --cc=mgorman@suse.de \
    --cc=riel@redhat.com \
    --cc=sudipm.mukherjee@gmail.com \
    /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