From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <ryan.roberts@arm.com>,
Matthew Wilcox <willy@infradead.org>,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH v2] mm: memory: move mem_cgroup_charge() into alloc_anon_folio()
Date: Sat, 20 Jan 2024 10:13:19 +0800 [thread overview]
Message-ID: <2160e2ea-20af-46c4-b6b1-a974eb09b490@huawei.com> (raw)
In-Reply-To: <ZaqZPxDUOuxRWB5l@tiehlicka>
On 2024/1/19 23:46, Michal Hocko wrote:
> On Fri 19-01-24 20:59:22, Kefeng Wang wrote:
>>>>> GFP_TRANSHUGE_LIGHT is more interesting though because those do not dive
>>>>> into the direct reclaim at all. With the current code they will reclaim
>>>>> charges to free up the space for the allocated THP page and that defeats
>>>>> the light mode. I have a vague recollection of preparing a patch to
>>>>
>>>> We are interesting to GFP_TRANSHUGE_LIGHT and _GFP_NORETRY as mentioned
>>>> above.
>>>
>>> if mTHP can be smaller than COSTLY_ORDER then you are correct and
>>> NORETRY makes a difference. Please mention that in the changelog as
>>> well.
>>>
>>
>> For memory cgroup charge, _GFP_NORETRY checked to make us directly skip
>> mem_cgroup_oom(), it has no concern with folio order or COSTLY_ORDER when
>> check _GFP_NORETRY in try_charge_memcg(), so I think NORETRY should
>> always make difference for all large order folio.
>
> we do not OOM on COSTLY_ORDER (see mem_cgroup_oom). So NORETRY really
> makes a difference for small orders.
I see what you mean, but we may describe the different processes, if
GFP_TRANSHUGE | __GFP_NORETRY returned from vma_thp_gfp_mask(),
then we never involved with mem_cgroup_oom(), since mem_cgroup_oom()
will be skipped in try_charge_memcg(), that is what I want to say,
and in this case, no oom for order < COSTLY_ORDER or order >
COSTLY_ORDER. But if GFP is GFP_TRANHUGE, then we may enter
mem_cgroup_oom(), and maybe oom if order < COSTLY_ORDER.
So Yes, NORETRY really makes a difference for small orders.
prev parent reply other threads:[~2024-01-20 2:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 10:39 Kefeng Wang
2024-01-18 14:49 ` Ryan Roberts
2024-01-18 15:59 ` Michal Hocko
2024-01-19 2:05 ` Kefeng Wang
2024-01-19 8:00 ` Michal Hocko
2024-01-19 12:59 ` Kefeng Wang
2024-01-19 15:46 ` Michal Hocko
2024-01-20 2:13 ` Kefeng Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2160e2ea-20af-46c4-b6b1-a974eb09b490@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=ryan.roberts@arm.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox