From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: akpm@linux-foundation.org, riel@redhat.com,
kirill.shutemov@linux.intel.com, ebru.akagunduz@gmail.com,
dan.carpenter@oracle.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 4/5] khugepaged: remove unnecessary mem_cgroup_uncharge() in collapse_[file|huge_page]
Date: Fri, 5 Mar 2021 20:38:09 +0300 [thread overview]
Message-ID: <20210305173809.ufg6rfgmvgbvwxih@box> (raw)
In-Reply-To: <20210304123013.23560-5-linmiaohe@huawei.com>
On Thu, Mar 04, 2021 at 07:30:12AM -0500, Miaohe Lin wrote:
> Since commit 7ae88534cdd9 ("mm: move mem_cgroup_uncharge out of
> __page_cache_release()"), the mem_cgroup will be uncharged when hpage is
> freed. Uncharge mem_cgroup here is harmless but it looks confusing and
> buggy: if mem_cgroup charge failed, we will call mem_cgroup_uncharge()
> uncorrectly in error path because hpage is not IS_ERR_OR_NULL().
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Hm. I'm not sure about this patch.
For !NUMA the page will get allocated and freed very early: in
khugepaged_do_scan() and with the change mem_cgroup_charge() may get
called twice for two different mm_structs.
Is it safe?
--
Kirill A. Shutemov
next prev parent reply other threads:[~2021-03-05 17:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 12:30 [PATCH 0/5] Cleanup and fixup for khugepaged Miaohe Lin
2021-03-04 12:30 ` [PATCH 1/5] khugepaged: remove unneeded return value of khugepaged_collapse_pte_mapped_thps() Miaohe Lin
2021-03-04 12:30 ` [PATCH 2/5] khugepaged: reuse the smp_wmb() inside __SetPageUptodate() Miaohe Lin
2021-03-04 12:30 ` [PATCH 3/5] khugepaged: use helper khugepaged_test_exit() in __khugepaged_enter() Miaohe Lin
2021-03-04 12:30 ` [PATCH 4/5] khugepaged: remove unnecessary mem_cgroup_uncharge() in collapse_[file|huge_page] Miaohe Lin
2021-03-05 17:38 ` Kirill A. Shutemov [this message]
2021-03-06 3:18 ` Miaohe Lin
2021-03-04 12:30 ` [PATCH 5/5] khugepaged: fix wrong result value for trace_mm_collapse_huge_page_isolate() Miaohe Lin
2021-03-05 17:40 ` [PATCH 0/5] Cleanup and fixup for khugepaged Kirill A. Shutemov
2021-03-06 2:44 ` Miaohe Lin
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=20210305173809.ufg6rfgmvgbvwxih@box \
--to=kirill@shutemov.name \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@oracle.com \
--cc=ebru.akagunduz@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
/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