Re: [PATCH RFC] mm: warn potential return NULL for kmalloc_array and kvmalloc_array with __GFP_NOFAIL

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

 



On Fri, Jul 19, 2024 at 7:02 PM Michal Hocko <mhocko@xxxxxxxx> wrote:
>
> On Fri 19-07-24 12:35:55, Barry Song wrote:
> > On Thu, Jul 18, 2024 at 8:50 PM Michal Hocko <mhocko@xxxxxxxx> wrote:
> [...]
> > > Yes, those shouldn't really fail. NOWAIT|NOFAIL was something that
> > > should never happen and I really hope it doesn't. Others should really
> > > retry but it's been some time since I've checked the last time.
> >
> >
> > I assume allocations directly using alloc_pages() might not respect GFP_NOFAIL
> > and violate the semantics of GFP_NOFAIL.
>
> What do you mean?

I mean, if we are using wrappers like vmalloc (GFP_NOFAIL | GFP_NOWAIT),
though alloc_pages might return NULL, vmalloc for itself will retry.

but if you call alloc_pages() directly with GFP_NOFAIL | GFP_NOWAIT,
alloc_pages() may return NULL without retry at all. I believe alloc_pages()
is also wrong.

>
> > Additionally, at least drivers/vdpa/vdpa_user/iova_domain.c is
> > incorrect with GFP_ATOMIC
> > | __GFP_NOFAIL.
>
> This is broken! Please bring this up with the maintainer of the code.
>
> [...]
>
> > GFP_NOFAIL things need to be fixed. Let me investigate further.
>
> Thanks!
>
> --
> Michal Hocko
> SUSE Labs





[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