+ mm-thp-update-split_queue_len-correctly.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm: thp: update split_queue_len correctly
has been added to the -mm tree.  Its filename is
     mm-thp-update-split_queue_len-correctly.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-thp-update-split_queue_len-correctly.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-thp-update-split_queue_len-correctly.patch

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 and is updated
there every 3-4 working days

------------------------------------------------------
From: Shakeel Butt <shakeelb@xxxxxxxxxx>
Subject: mm: thp: update split_queue_len correctly

The deferred THPs are split on memory pressure through shrinker callback
and splitting of THP during reclaim can fail for several reasons like
unable to lock the THP, under writeback or unexpected number of pins on
the THP.  Such pages are put back on the deferred split list for
consideration later.  However kernel does not update the deferred queue
size on putting back the pages whose split was failed.  This patch fixes
that.

Without this patch the split_queue_len can underflow.  Shrinker will
always get that there are some THPs to split even if there are not and
waste some cpu to scan the empty list.

Link: https://lkml.kernel.org/r/20211123190916.1738458-1-shakeelb@xxxxxxxxxx
Fixes: 364c1eebe453 ("mm: thp: extract split_queue_* into a struct")
Signed-off-by: Shakeel Butt <shakeelb@xxxxxxxxxx>
Reviewed-by: Yang Shi <shy828301@xxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Cc: "Kirill A . Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
Cc: Zi Yan <ziy@xxxxxxxxxx>
Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/huge_memory.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/mm/huge_memory.c~mm-thp-update-split_queue_len-correctly
+++ a/mm/huge_memory.c
@@ -2809,7 +2809,7 @@ static unsigned long deferred_split_scan
 	unsigned long flags;
 	LIST_HEAD(list), *pos, *next;
 	struct page *page;
-	int split = 0;
+	unsigned long split = 0;
 
 #ifdef CONFIG_MEMCG
 	if (sc->memcg)
@@ -2847,6 +2847,7 @@ next:
 
 	spin_lock_irqsave(&ds_queue->split_queue_lock, flags);
 	list_splice_tail(&list, &ds_queue->split_queue);
+	ds_queue->split_queue_len -= split;
 	spin_unlock_irqrestore(&ds_queue->split_queue_lock, flags);
 
 	/*
_

Patches currently in -mm which might be from shakeelb@xxxxxxxxxx are

memcg-better-bounds-on-the-memcg-stats-updates.patch
mm-thp-update-split_queue_len-correctly.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux