Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631535

Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks

From Igor Stoppa <igor.stoppa@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks
Date 2017-04-26 17:40 +0200
Message-ID <tAxcS-4ap-13@gated-at.bofh.it> (permalink)
References <tAvkJ-2S4-3@gated-at.bofh.it> <tAvkJ-2S4-1@gated-at.bofh.it> <tAwqu-3Ay-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 26/04/17 17:47, Michal Hocko wrote:
> On Wed 26-04-17 16:35:49, Igor Stoppa wrote:
>> The bitmasks used for ___GFP_xxx can be defined in terms of an enum,
>> which doesn't require manual updates to its values.
> 
> GFP masks are rarely updated so why is this worth doing?

I have plans for that [1] - yeah, I should have not written only to ml -
but I thought there was sufficient value in this patch to be sent alone.

I got into this part of the code because (if I understood correctly)
there are no spare bits available from the 32bits mask that is currently
in use.

Adding a new zone, therefore, would cause the bumping to a 64bits type.
If the zone is not strictly needed, some people might prefer to have the
option to stick to 32 bits.

Which in turn would mean more #ifdefs.

Using the enum should provide the same flexibility with a more limited
number of #ifdefs in the code.

But I really thought that there is a value in the change per-se.
Regardless of what other patches might follow.


>> As bonus, __GFP_BITS_SHIFT is automatically kept consistent.
> 
> this alone doesn't sound like a huge win to me, to be honest. We already
> have ___GFP_$FOO and __GFP_FOO you are adding __GFP_$FOO_SHIFT. This is
> too much IMHO.

I do not like the #defines being floating and potentially inconsistent
with the rest, when they are supposed to represent all the individual
bits in a bitmask.
One might argue that an error will be detected fairly soon, but to me
using an enum to automatically manage the values and counter of items
seems preferable.

> Also the current mm tree has ___GFP_NOLOCKDEP which is not addressed
> here so I suspect you have based your change on the Linus tree.

I used your tree from kernel.org - I asked yesterday on #mm if it was a
good idea and was told that it should be ok, so I did it, but I can redo
the patch with mm.


If you prefer to have this patch only as part of the larger patchset,
I'm also fine with it.
Also, if you could reply to [1], that would be greatly appreciated.

Maybe I'm starting from some wrong assumption or there is a better way
to achieve what I want.


thanks, igor

[1] http://marc.info/?l=linux-mm&m=149276346722464&w=2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks Igor Stoppa <igor.stoppa@huawei.com> - 2017-04-26 15:40 +0200
  Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks Michal Hocko <mhocko@kernel.org> - 2017-04-26 16:50 +0200
    Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks Igor Stoppa <igor.stoppa@huawei.com> - 2017-04-26 17:40 +0200
      Question on ___GFP_NOLOCKDEP - Was: Re: [PATCH 1/1] Remove hardcoding  of ___GFP_xxx bitmasks Igor Stoppa <igor.stoppa@huawei.com> - 2017-04-27 14:20 +0200
        Re: Question on ___GFP_NOLOCKDEP - Was: Re: [PATCH 1/1] Remove  hardcoding of ___GFP_xxx bitmasks Michal Hocko <mhocko@kernel.org> - 2017-04-27 15:40 +0200
          Re: Question on ___GFP_NOLOCKDEP - Was: Re: [PATCH 1/1] Remove  hardcoding of ___GFP_xxx bitmasks Vlastimil Babka <vbabka@suse.cz> - 2017-05-10 17:30 +0200
      Question on ___GFP_NOLOCKDEP - Was: Re: [PATCH 1/1] Remove hardcoding  of ___GFP_xxx bitmasks Igor Stoppa <igor.stoppa@huawei.com> - 2017-04-27 14:30 +0200
      Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks Michal Hocko <mhocko@kernel.org> - 2017-04-27 15:50 +0200
        Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks Igor Stoppa <igor.stoppa@huawei.com> - 2017-04-27 16:10 +0200
          Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks Michal Hocko <mhocko@kernel.org> - 2017-04-28 09:50 +0200
            Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks Igor Stoppa <igor.stoppa@huawei.com> - 2017-04-28 09:50 +0200
              Re: [PATCH 1/1] Remove hardcoding of ___GFP_xxx bitmasks Igor Stoppa <igor.stoppa@huawei.com> - 2017-04-28 10:20 +0200

csiph-web