linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Yin Fengwei <fengwei.yin@intel.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, yuzhao@google.com,
	ryan.roberts@arm.com
Subject: Re: [PATCH 2/2] lru: allow large batched add large folio to lru list
Date: Mon, 17 Apr 2023 13:25:53 +0100	[thread overview]
Message-ID: <ZD060bJsKj8GHylq@casper.infradead.org> (raw)
In-Reply-To: <20230417075643.3287513-3-fengwei.yin@intel.com>

On Mon, Apr 17, 2023 at 03:56:43PM +0800, Yin Fengwei wrote:
> Currently, large folio is not batched added to lru list. Which
> cause high lru lock contention after enable large folio for
> anonymous mappping.

Obviously, I think we should be doing a batched add, but I don't think
this is right.

> @@ -54,7 +57,12 @@ static inline unsigned pagevec_space(struct pagevec *pvec)
>  static inline unsigned pagevec_add(struct pagevec *pvec, struct page *page)
>  {
>  	pvec->pages[pvec->nr++] = page;
> -	return pagevec_space(pvec);
> +	pvec->pages_nr += compound_nr(page);
> +
> +	if (pvec->pages_nr > PAGEVEC_SIZE)
> +		return 0;
> +	else
> +		return pagevec_space(pvec);

I assume your thinking here is that we should limit the number of pages
in the batches, but I think we should allow the number of folios to reach
PAGEVEC_SIZE before we drain the batch onto the LRU list.  That will
reduce the contention on the LRU lock even further.



  reply	other threads:[~2023-04-17 12:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17  7:56 [PATCH 0/2] Reduce lock contention related with large folio Yin Fengwei
2023-04-17  7:56 ` [PATCH 1/2] THP: avoid lock when check whether THP is in deferred list Yin Fengwei
2023-04-17  7:56 ` [PATCH 2/2] lru: allow large batched add large folio to lru list Yin Fengwei
2023-04-17 12:25   ` Matthew Wilcox [this message]
2023-04-18  1:57     ` Yin Fengwei
2023-04-18  2:37       ` Yin Fengwei
2023-04-18  6:39         ` Huang, Ying
2023-04-17 10:33 ` [PATCH 0/2] Reduce lock contention related with large folio Ryan Roberts

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=ZD060bJsKj8GHylq@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=fengwei.yin@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    --cc=yuzhao@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