linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Zhiguo Jiang <justinjiang@vivo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Barry Song <baohua@kernel.org>,
	opensource.kernel@vivo.com,
	Qianfeng Rong <rongqianfeng@vivo.corp-partner.google.com>
Subject: Re: [PATCH v4] mm: shrink skip folio mapped by an exiting task
Date: Mon, 8 Jul 2024 04:34:17 +0100	[thread overview]
Message-ID: <ZoteOYap1M4kxWV8@casper.infradead.org> (raw)
In-Reply-To: <20240708031517.856-1-justinjiang@vivo.com>

On Mon, Jul 08, 2024 at 11:15:17AM +0800, Zhiguo Jiang wrote:
> If an anon folio reclaimed by shrink_inactive_list is mapped by an
> exiting task, this anon folio will be firstly swaped-out into
> swapspace in shrink flow and then this swap folio is freed in task
> exit flow. But if this folio mapped by an exiting task can skip
> shrink and be freed directly in task exiting flow, which will save
> swap-out time and alleviate the load of the tasks exiting process.
> The file folio is also similar.

How is the file folio similar?  File folios are never written to swap,
and they'll be written back from the page cache whenever the filesystem
decides it's a good time to do so.

>  mm/rmap.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>  mode change 100644 => 100755 mm/rmap.c

Uh, what?  Why would you make this file executable?

> diff --git a/mm/rmap.c b/mm/rmap.c
> index 26806b49a86f..16b7ed04bcbe
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -843,6 +843,16 @@ static bool folio_referenced_one(struct folio *folio,
>  	int referenced = 0;
>  	unsigned long start = address, ptes = 0;
>  
> +	/* Skip the unshared folios mapped only by the single
> +	 * exiting process.
> +	 */

Comments start with a /* on a line by itself.

> +	if ((!atomic_read(&vma->vm_mm->mm_users) ||
> +		test_bit(MMF_OOM_SKIP, &vma->vm_mm->flags)) &&
> +		!test_bit(VM_SHARED, &vma->vm_flags)) {
> +		pra->referenced = -1;
> +		return false;

This indentation is unreadable.  Follow the style used in the rest of
the file.



  reply	other threads:[~2024-07-08  3:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08  3:15 Zhiguo Jiang
2024-07-08  3:34 ` Matthew Wilcox [this message]
2024-07-08  4:52   ` zhiguojiang
2024-07-08  9:25   ` zhiguojiang
2024-07-08  3:34 ` Barry Song

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=ZoteOYap1M4kxWV8@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=justinjiang@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=opensource.kernel@vivo.com \
    --cc=rongqianfeng@vivo.corp-partner.google.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