mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Subject: Re: regression: mm: vmscan:  -  size XL irqoff time increase v6.10+
Date: Wed, 30 Oct 2024 07:30:24 +0100	[thread overview]
Message-ID: <fda44f45fe5aea109ccc3e20c7e583b4b649a728.camel@gmx.de> (raw)
In-Reply-To: <88ae633aa910c7e320b89e5f4779d472f7cffffb.camel@gmx.de>

On Tue, 2024-10-29 at 13:03 +0100, Mike Galbraith wrote:
> Greetings,
>
> I've noticed size XL cyclictest -Smp99 wakeup latency spikes for some
> time now, but due to bandwidth etc (ie laziness), never got around to
> taking a peek until today.

isolate_lru_folios() dropped off the irqsoff radar with the below.

mm: vmscan: Limit isolate_lru_folios() IRQ holdoff latency impact.

While examining an RT latency regression beginning at v6.10, it was
discovered that isolate_lru_folios() runtimes could cause IRQ holdoff
to easily span several ticks.

Given it's called with IRQs disabled, cap its runtme to around a ms.

Signed-off-by: Mike Galbraith <efault@gmx.de>
---
 mm/vmscan.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -63,6 +63,7 @@
 #include <linux/swapops.h>
 #include <linux/balloon_compaction.h>
 #include <linux/sched/sysctl.h>
+#include <linux/sched/clock.h>

 #include "internal.h"
 #include "swap.h"
@@ -1656,6 +1657,8 @@ static unsigned long isolate_lru_folios(
 	unsigned long nr_skipped[MAX_NR_ZONES] = { 0, };
 	unsigned long skipped = 0;
 	unsigned long scan, total_scan, nr_pages;
+	int cpu = raw_smp_processor_id(), iter = 0;
+	u64 then = cpu_clock(cpu);
 	LIST_HEAD(folios_skipped);

 	total_scan = 0;
@@ -1709,6 +1712,15 @@ static unsigned long isolate_lru_folios(
 		move_to = dst;
 move:
 		list_move(&folio->lru, move_to);
+
+		/*
+		 * IRQs are disabled, cap holdoff at a millisecond or so.
+		 */
+		if (iter++ < 1000)
+			continue;
+		if (cpu_clock(cpu) - then > NSEC_PER_MSEC)
+			break;
+		iter = 0;
 	}

 	/*


  reply	other threads:[~2024-10-30  6:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 12:03 Mike Galbraith
2024-10-30  6:30 ` Mike Galbraith [this message]
2024-10-31 10:21 ` RFC [PATCH1] mm: vmscan: Limit isolate_lru_folios() IRQ holdoff latency impact Mike Galbraith
2024-10-31 10:21 ` RFC [PATCH2] fs/writeback: Mitigate move_expired_inodes() induced service latency Mike Galbraith
2024-10-31 10:28   ` Mike Galbraith

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=fda44f45fe5aea109ccc3e20c7e583b4b649a728.camel@gmx.de \
    --to=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ryan.roberts@arm.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®