From: wangjianxing <wangjianxing@loongson.cn>
To: Peter Zijlstra <peterz@infradead.org>
Cc: will@kernel.org, aneesh.kumar@linux.ibm.com,
akpm@linux-foundation.org, npiggin@gmail.com,
linux-arch@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mm/mmu_gather: limit tlb batch count and add schedule point in tlb_batch_pages_flush
Date: Thu, 17 Mar 2022 10:21:54 +0800 [thread overview]
Message-ID: <1c2b999d-4924-25c5-cb8a-2be951c8c2a9@loongson.cn> (raw)
In-Reply-To: <YjGmkOKfmj71bfMA@hirez.programming.kicks-ass.net>
On 03/16/2022 04:57 PM, Peter Zijlstra wrote:
> This seems like a really complicated way of writing something like the
> below...
>
> diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c
> index afb7185ffdc4..b382e86c1b47 100644
> --- a/mm/mmu_gather.c
> +++ b/mm/mmu_gather.c
> @@ -47,8 +47,17 @@ static void tlb_batch_pages_flush(struct mmu_gather *tlb)
> struct mmu_gather_batch *batch;
>
> for (batch = &tlb->local; batch && batch->nr; batch = batch->next) {
> - free_pages_and_swap_cache(batch->pages, batch->nr);
> - batch->nr = 0;
> + struct page_struct *pages = batch->pages;
> +
> + do {
> + int nr = min(512, batch->nr);
> +
> + free_pages_and_swap_cache(pages, nr);
> + pages += nr;
> + batch->nr -= nr;
> +
> + cond_resched();
> + } while (batch->nr);
> }
> tlb->active = &tlb->local;
> }
Yeah, it looks nicer.
I will resubmit the patch.
prev parent reply other threads:[~2022-03-17 2:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 12:55 Jianxing Wang
2022-03-15 12:56 ` wangjianxing
2022-03-16 8:57 ` Peter Zijlstra
2022-03-17 2:21 ` wangjianxing [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=1c2b999d-4924-25c5-cb8a-2be951c8c2a9@loongson.cn \
--to=wangjianxing@loongson.cn \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
--cc=will@kernel.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