[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aeb2bd3990004b9eb4f151aa833ddcf2@huawei.com>
Date: Sun, 19 Mar 2023 07:22:50 +0000
From: "chenjun (AM)" <chenjun102@...wei.com>
To: Vlastimil Babka <vbabka@...e.cz>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"cl@...ux.com" <cl@...ux.com>,
"penberg@...nel.org" <penberg@...nel.org>,
"rientjes@...gle.com" <rientjes@...gle.com>,
"iamjoonsoo.kim@....com" <iamjoonsoo.kim@....com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
Hyeonggon Yoo <42.hyeyoo@...il.com>
CC: "xuqiang (M)" <xuqiang36@...wei.com>,
"Wangkefeng (OS Kernel Lab)" <wangkefeng.wang@...wei.com>
Subject: Re: [PATCH] mm/slub: Reduce memory consumption in extreme scenarios
在 2023/3/17 20:06, Vlastimil Babka 写道:
> On 3/17/23 12:32, chenjun (AM) wrote:
>> 在 2023/3/14 22:41, Vlastimil Babka 写道:
>>>> pc.flags = gfpflags;
>>>> +
>>>> + /*
>>>> + * when (node != NUMA_NO_NODE) && (gfpflags & __GFP_THISNODE)
>>>> + * 1) try to get a partial slab from target node with __GFP_THISNODE.
>>>> + * 2) if 1) failed, try to allocate a new slab from target node with
>>>> + * __GFP_THISNODE.
>>>> + * 3) if 2) failed, retry 1) and 2) without __GFP_THISNODE constraint.
>>>> + */
>>>> + if (node != NUMA_NO_NODE && !(gfpflags & __GFP_THISNODE) && try_thisnode)
>>>> + pc.flags |= __GFP_THISNODE;
>>>
>>> Hmm I'm thinking we should also perhaps remove direct reclaim possibilities
>>> from the attempt 2). In your qemu test it should make no difference, as it
>>> fills everything with kernel memory that is not reclaimable. But in practice
>>> the target node might be filled with user memory, and I think it's better to
>>> quickly allocate on a different node than spend time in direct reclaim. So
>>> the following should work I think?
>>>
>>> pc.flags = GFP_NOWAIT | __GFP_NOWARN |__GFP_THISNODE
>>>
>>
>> Hmm, Should it be that:
>>
>> pc.flags |= GFP_NOWAIT | __GFP_NOWARN |__GFP_THISNODE
>
> No, we need to ignore the other reclaim-related flags that the caller
> passed, or it wouldn't work as intended.
> The danger is that we ignore some flag that would be necessary to pass, but
> I don't think there's any?
>
>
If we ignore __GFP_ZERO passed by kzalloc, kzalloc will not work.
Could we just unmask __GFP_RECLAIMABLE | __GFP_RECLAIM?
pc.flags &= ~(__GFP_RECLAIMABLE | __GFP_RECLAIM)
pc.flags |= __GFP_THISNODE
Powered by blists - more mailing lists