Re: [PATCH V4] mlx4_core: allocate ICM memory in page size chunks

From: Michal Hocko
Date: Thu May 31 2018 - 04:56:00 EST


On Thu 31-05-18 04:35:31, Eric Dumazet wrote:
>
>
> On 05/31/2018 02:54 AM, Michal Hocko wrote:
> > On Tue 29-05-18 23:49:59, Eric Dumazet wrote:
> >>
> >>
> >> On 05/29/2018 11:44 PM, Eric Dumazet wrote:
> >>
> >>>
> >>> And I will add this simple fix, this really should address your initial concern much better.
> >>>
> >>> @@ -99,6 +100,8 @@ static int mlx4_alloc_icm_pages(struct scatterlist *mem, int order,
> >>> {
> >>> struct page *page;
> >>>
> >>> + if (order)
> >>> + gfp_mask |= __GFP_NORETRY;
> >>
> >> and also gfp_mask &= ~__GFP_DIRECT_RECLAIM
> >
> > JFTR the latter one makes __GFP_NORETRY pointless. Non sleeping allocations
> > are not retrying.
>
> Hi Michal
>
> Since when this rule is applied ?

Well, this has been the case since I remember. ~__GFP_DIRECT_RECLAIM
resp. GFP_NOWAIT formerly meant that the allocation doesn't perform
_any_ reclaim and therefore it never retries. Why would it? Any retry
would just hope for a reclaim on behalf of somebody else. __GFP_NORETRY
has always simply stopped retrying after one/few reclaim attempts.
Implementation has changed here and there over time but in essence the
semantic remained the same. Please have a look at the current
documentation in gfp.h file and let me know if you would like some
clarfications.

> These GFP flags change all the time, I suggest mm experts to cleanup existing call sites ?

Do you have any specific areas to look at?

> I merely copied/pasted from alloc_skb_with_frags() :/

I will have a look at it. Thanks!
--
Michal Hocko
SUSE Labs