Re: slab_pre_alloc_hook() strips __GFP_NOLOCKDEP away.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022-03-23 11:09:35 [+0100], Vlastimil Babka wrote:
> > --- a/mm/slab.h
> > +++ b/mm/slab.h
> > @@ -717,7 +717,7 @@ static inline struct kmem_cache *slab_pre_alloc_hook(struct kmem_cache *s,
> >  						     struct obj_cgroup **objcgp,
> >  						     size_t size, gfp_t flags)
> >  {
> > -	flags &= gfp_allowed_mask;
> > +	flags &= gfp_allowed_mask | __GFP_NOLOCKDEP;
> 
> Hmm but gfp_allowed_mask already should contain __GFP_NOLOCKDEP after
> kernel_init_freeable() is reached. I doubt we can reach fs or reclaim
> code before that?

That is way past init. I have
 gfp_allowed_mask = 0x1ffffff
 __GFP_NOLOCKDEP = 0x8000000

Looking at the origin of gfp_allowed_mask

| /* Room for N __GFP_FOO bits */
| #define __GFP_BITS_SHIFT (24 +                                          \
|                           3 * IS_ENABLED(CONFIG_KASAN_HW_TAGS) +        \
|                           IS_ENABLED(CONFIG_LOCKDEP))
| #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))

which in my case 24 + 1 but it would need to be something like
	27 * IS_ENABLED(CONFIG_LOCKDEP)

or a better way to come up with __GFP_BITS_MASK.

Sebastian




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux