The patch titled Subject: mm/vmscan: simplify the nr assignment logic for pages to scan has been added to the -mm mm-unstable branch. Its filename is mm-vmscan-simplify-the-nr-assignment-logic-for-pages-to-scan.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmscan-simplify-the-nr-assignment-logic-for-pages-to-scan.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Chao Xu <amos.xuchao@xxxxxxxxx> Subject: mm/vmscan: simplify the nr assignment logic for pages to scan Date: Thu, 10 Nov 2022 19:31:30 +0800 By default the assignment logic of anonymouns or file inactive pages and active pages to scan using the same duplicated code snippet. To simplify the logic, merge the same part. Link: https://lkml.kernel.org/r/20221110113130.284290-1-Chao.Xu9@xxxxxxxxxxxxx Signed-off-by: Chao Xu <Chao.Xu9@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) --- a/mm/vmscan.c~mm-vmscan-simplify-the-nr-assignment-logic-for-pages-to-scan +++ a/mm/vmscan.c @@ -5950,14 +5950,11 @@ static void shrink_lruvec(struct lruvec * scan target and the percentage scanning already complete */ lru = (lru == LRU_FILE) ? LRU_BASE : LRU_FILE; - nr_scanned = targets[lru] - nr[lru]; - nr[lru] = targets[lru] * (100 - percentage) / 100; - nr[lru] -= min(nr[lru], nr_scanned); - - lru += LRU_ACTIVE; - nr_scanned = targets[lru] - nr[lru]; - nr[lru] = targets[lru] * (100 - percentage) / 100; - nr[lru] -= min(nr[lru], nr_scanned); + for ( ; lru <= lru + LRU_ACTIVE; lru += LRU_ACTIVE) { + nr_scanned = targets[lru] - nr[lru]; + nr[lru] = targets[lru] * (100 - percentage) / 100; + nr[lru] -= min(nr[lru], nr_scanned); + } scan_adjusted = true; } _ Patches currently in -mm which might be from amos.xuchao@xxxxxxxxx are mm-vmscan-simplify-the-nr-assignment-logic-for-pages-to-scan.patch