From: Zach O'Keefe <zokeefe@google.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
David Stevens <stevensd@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
Yang Shi <shy828301@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH] mm/khugepaged: Cleanup memcg uncharge for failure path
Date: Fri, 3 Mar 2023 07:22:56 -0800 [thread overview]
Message-ID: <20230303152256.a5z3wc2v6wri5ijy@google.com> (raw)
In-Reply-To: <20230303151218.311015-1-peterx@redhat.com>
Thanks Peter!
On Mar 03 10:12, Peter Xu wrote:
> Explicit memcg uncharging is not needed when the memcg accounting has the
> same lifespan of the page/folio. That becomes the case for khugepaged
> after Yang & Zach's recent rework so the hpage will be allocated for each
> collapse rather than being cached.
>
> Cleanup the explicit memcg uncharge in khugepaged failure path and leave
> that for put_page().
>
> Suggested-by: Zach O'Keefe <zokeefe@google.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Zach O'Keefe <zokeefe@google.com>
> ---
> mm/khugepaged.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 941d1c7ea910..dd5a7d9bc593 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -1230,10 +1230,8 @@ static int collapse_huge_page(struct mm_struct *mm, unsigned long address,
> out_up_write:
> mmap_write_unlock(mm);
> out_nolock:
> - if (hpage) {
> - mem_cgroup_uncharge(page_folio(hpage));
> + if (hpage)
> put_page(hpage);
> - }
> trace_mm_collapse_huge_page(mm, result == SCAN_SUCCEED, result);
> return result;
> }
> @@ -2250,10 +2248,8 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
> unlock_page(hpage);
> out:
> VM_BUG_ON(!list_empty(&pagelist));
> - if (hpage) {
> - mem_cgroup_uncharge(page_folio(hpage));
> + if (hpage)
> put_page(hpage);
> - }
>
> trace_mm_khugepaged_collapse_file(mm, hpage, index, is_shmem, addr, file, nr, result);
> return result;
> --
> 2.39.1
>
next prev parent reply other threads:[~2023-03-03 15:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 15:12 [PATCH] mm/khugepaged: Cleanup memcg uncharge for failure path Peter Xu
2023-03-03 15:22 ` Zach O'Keefe [this message]
2023-03-03 19:00 ` Yang Shi
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=20230303152256.a5z3wc2v6wri5ijy@google.com \
--to=zokeefe@google.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=shy828301@gmail.com \
--cc=stevensd@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.