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,
opensource.kernel@vivo.com
Subject: Re: [PATCH] mm:vmscan: fix shrink sc->nr counter values issue
Date: Wed, 29 Nov 2023 15:17:43 +0000 [thread overview]
Message-ID: <ZWdWFx1mXl29dP5U@casper.infradead.org> (raw)
In-Reply-To: <20231129130126.2130-1-justinjiang@vivo.com>
On Wed, Nov 29, 2023 at 09:01:26PM +0800, Zhiguo Jiang wrote:
> It is needed to ensure sc->nr.unqueued_dirty > 0, which can avoid to
> set PGDAT_DIRTY flag when sc->nr.unqueued_dirty and sc->nr.file_taken
> are both zero at the same time.
Have you observed this happening, or is this from code review?
> It can't be guaranteed for the PGDAT_WRITEBACK flag that only pages
> marked for immediate reclaim are on evictable LRUs in other following
> shrink processes of the same kswapd shrink recycling. So when both a
> small amount of pages marked for immediate reclaim and a large amount
> of pages marked for non-immediate reclaim are on evictable LRUs at the
> same time, if it's only determined that there is at least a page marked
> for immediate reclaim on evictable LRUs, kswapd shrink is throttled to
> sleep, which will increase kswapd process consumption.
>
> It can be fixed to throttle kswapd shrink when sc->nr.immediate is equal
> to sc->nr.file_taken.
So you're fixing two distinct things in the same patch?
> +++ b/mm/vmscan.c
> @@ -5915,17 +5915,17 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc)
> set_bit(PGDAT_WRITEBACK, &pgdat->flags);
>
> /* Allow kswapd to start writing pages during reclaim.*/
> - if (sc->nr.unqueued_dirty == sc->nr.file_taken)
> + if (sc->nr.unqueued_dirty && sc->nr.unqueued_dirty == sc->nr.file_taken)
> set_bit(PGDAT_DIRTY, &pgdat->flags);
>
> /*
> - * If kswapd scans pages marked for immediate
> + * If kswapd scans massive pages marked for immediate
I don't understand why you've added the word "massive". Do you mean
that the pages are large, or that kswapd has scanned a lot of pages?
> * reclaim and under writeback (nr_immediate), it
> * implies that pages are cycling through the LRU
> * faster than they are written so forcibly stall
> * until some pages complete writeback.
> */
> - if (sc->nr.immediate)
> + if (sc->nr.immediate && sc->nr.immediate == sc->nr.file_taken)
> reclaim_throttle(pgdat, VMSCAN_THROTTLE_WRITEBACK);
> }
next prev parent reply other threads:[~2023-11-29 15:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 13:01 Zhiguo Jiang
2023-11-29 15:17 ` Matthew Wilcox [this message]
2023-11-30 1:56 ` zhiguojiang
2023-11-30 3:29 ` Matthew Wilcox
2023-11-30 3:40 ` zhiguojiang
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=ZWdWFx1mXl29dP5U@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=justinjiang@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=opensource.kernel@vivo.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
all inboxes | Powered by JetHome®