linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kfence: use TASK_IDLE when awaiting allocation
@ 2021-05-21  8:32 Marco Elver
  2021-05-21  9:37 ` Hillf Danton
  2021-05-21  9:39 ` David Laight
  0 siblings, 2 replies; 6+ messages in thread
From: Marco Elver @ 2021-05-21  8:32 UTC (permalink / raw)
  To: elver, akpm
  Cc: glider, dvyukov, linux-kernel, linux-mm, kasan-dev, Mel Gorman, stable

Since wait_event() uses TASK_UNINTERRUPTIBLE by default, waiting for an
allocation counts towards load. However, for KFENCE, this does not make
any sense, since there is no busy work we're awaiting.

Instead, use TASK_IDLE via wait_event_idle() to not count towards load.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1185565
Fixes: 407f1d8c1b5f ("kfence: await for allocation using wait_event")
Signed-off-by: Marco Elver <elver@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: <stable@vger.kernel.org> # v5.12+
---
 mm/kfence/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/kfence/core.c b/mm/kfence/core.c
index e18fbbd5d9b4..4d21ac44d5d3 100644
--- a/mm/kfence/core.c
+++ b/mm/kfence/core.c
@@ -627,10 +627,10 @@ static void toggle_allocation_gate(struct work_struct *work)
 		 * During low activity with no allocations we might wait a
 		 * while; let's avoid the hung task warning.
 		 */
-		wait_event_timeout(allocation_wait, atomic_read(&kfence_allocation_gate),
-				   sysctl_hung_task_timeout_secs * HZ / 2);
+		wait_event_idle_timeout(allocation_wait, atomic_read(&kfence_allocation_gate),
+					sysctl_hung_task_timeout_secs * HZ / 2);
 	} else {
-		wait_event(allocation_wait, atomic_read(&kfence_allocation_gate));
+		wait_event_idle(allocation_wait, atomic_read(&kfence_allocation_gate));
 	}
 
 	/* Disable static key and reset timer. */
-- 
2.31.1.818.g46aad6cb9e-goog



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-21 11:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21  8:32 [PATCH] kfence: use TASK_IDLE when awaiting allocation Marco Elver
2021-05-21  9:37 ` Hillf Danton
2021-05-21 11:17   ` Marco Elver
2021-05-21  9:39 ` David Laight
2021-05-21  9:47   ` Marco Elver
2021-05-21 10:15     ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox