lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <HK2PR03MB16843E14AD56B3E546D9F52D929F0@HK2PR03MB1684.apcprd03.prod.outlook.com>
Date:   Fri, 11 May 2018 03:24:34 +0000
From:   Huaisheng HS1 Ye <yehs1@...ovo.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "mhocko@...e.com" <mhocko@...e.com>,
        "vbabka@...e.cz" <vbabka@...e.cz>,
        "mgorman@...hsingularity.net" <mgorman@...hsingularity.net>,
        "alexander.levin@...izon.com" <alexander.levin@...izon.com>,
        "colyli@...e.de" <colyli@...e.de>,
        NingTing Cheng <chengnt@...ovo.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [External]  Re: [PATCH v1] include/linux/gfp.h: getting rid of
 GFP_ZONE_TABLE/BAD

> From: owner-linux-mm@...ck.org [mailto:owner-linux-mm@...ck.org] On Behalf Of Matthew
> Wilcox
> On Fri, May 11, 2018 at 12:10:25AM +0800, Huaisheng Ye wrote:
> > -#define __GFP_DMA	((__force gfp_t)___GFP_DMA)
> > -#define __GFP_HIGHMEM	((__force gfp_t)___GFP_HIGHMEM)
> > -#define __GFP_DMA32	((__force gfp_t)___GFP_DMA32)
> > +#define __GFP_DMA	((__force gfp_t)OPT_ZONE_DMA ^ ZONE_NORMAL)
> > +#define __GFP_HIGHMEM	((__force gfp_t)ZONE_MOVABLE ^ ZONE_NORMAL)
> > +#define __GFP_DMA32	((__force gfp_t)OPT_ZONE_DMA32 ^ ZONE_NORMAL)
> 
> No, you've made gfp_zone even more complex than it already is.
> If you can't use OPT_ZONE_HIGHMEM here, then this is a waste of time.
> 
Dear Matthew,

The reason why I don't use OPT_ZONE_HIGHMEM for __GFP_HIGHMEM	 directly is that, for x86_64 platform there is no CONFIG_HIGHMEM, so OPT_ZONE_HIGHMEM shall always be equal to ZONE_NORMAL.

For gfp_zone it is impossible to distinguish the meaning of lowest 3 bits in flags. How can gfp_zone to understand it comes from OPT_ZONE_HIGHMEM or ZONE_NORMAL?
And the most pained thing is that, if __GFP_HIGHMEM with movable flag enabled, it means that ZONE_MOVABLE shall be returned.
That is different from ZONE_DMA, ZONE_DMA32 and ZONE_NORMAL.

I was thinking...
Whether it is possible to use other judgement condition to decide OPT_ZONE_HIGHMEM or ZONE_MOVABLE shall be returned from gfp_zone.

Sincerely,
Huaisheng Ye


> >  static inline enum zone_type gfp_zone(gfp_t flags)
> >  {
> >  	enum zone_type z;
> > -	int bit = (__force int) (flags & GFP_ZONEMASK);
> > +	z = ((__force unsigned int)flags & ___GFP_ZONE_MASK) ^ ZONE_NORMAL;
> > +
> > +	if (z > OPT_ZONE_HIGHMEM)
> > +		z = OPT_ZONE_HIGHMEM +
> > +			!!((__force unsigned int)flags & ___GFP_MOVABLE);
> >
> > -	z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
> > -					 ((1 << GFP_ZONES_SHIFT) - 1);
> > -	VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
> > +	VM_BUG_ON(z > ZONE_MOVABLE);
> >  	return z;
> >  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ