mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, David.Laight@ACULAB.COM,
	dvyukov@google.com, elver@google.com, glider@google.com,
	hdanton@sina.com, linux-mm@kvack.org, mgorman@suse.de,
	mm-commits@vger.kernel.org, stable@vger.kernel.org,
	torvalds@linux-foundation.org
Subject: [patch 02/13] kfence: use TASK_IDLE when awaiting allocation
Date: Fri, 04 Jun 2021 20:01:11 -0700	[thread overview]
Message-ID: <20210605030111.zE60Ybm3T%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210604200040.d8d0406caf195525620c0f3d@linux-foundation.org>

From: Marco Elver <elver@google.com>
Subject: kfence: use TASK_IDLE when awaiting allocation

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
Link: https://lkml.kernel.org/r/20210521083209.3740269-1-elver@google.com
Fixes: 407f1d8c1b5f ("kfence: await for allocation using wait_event")
Signed-off-by: Marco Elver <elver@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Hillf Danton <hdanton@sina.com>
Cc: <stable@vger.kernel.org>	[5.12+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/kfence/core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/mm/kfence/core.c~kfence-use-task_idle-when-awaiting-allocation
+++ a/mm/kfence/core.c
@@ -627,10 +627,10 @@ static void toggle_allocation_gate(struc
 		 * 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. */
_

  parent reply	other threads:[~2021-06-05  3:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05  3:00 incoming Andrew Morton
2021-06-05  3:01 ` [patch 01/13] Revert "MIPS: make userspace mapping young by default" Andrew Morton
2021-06-05  3:01 ` Andrew Morton [this message]
2021-06-05  3:01 ` [patch 03/13] pid: take a reference when initializing `cad_pid` Andrew Morton
2021-06-05  3:01 ` [patch 04/13] mm/debug_vm_pgtable: fix alignment for pmd/pud_advanced_tests() Andrew Morton
2021-06-05  3:01 ` [patch 05/13] mm/page_alloc: fix counting of free pages after take off from buddy Andrew Morton
2021-06-05  3:01 ` [patch 06/13] drivers/base/memory: fix trying offlining memory blocks with memory holes on aarch64 Andrew Morton
2021-06-05  3:01 ` [patch 07/13] hugetlb: pass head page to remove_hugetlb_page() Andrew Morton
2021-06-05  3:01 ` [patch 08/13] proc: add .gitignore for proc-subset-pid selftest Andrew Morton
2021-06-05  3:01 ` [patch 09/13] mm/kasan/init.c: fix doc warning Andrew Morton
2021-06-05  3:01 ` [patch 10/13] mm, hugetlb: fix simple resv_huge_pages underflow on UFFDIO_COPY Andrew Morton
2021-06-05  3:01 ` [patch 11/13] lib: crc64: fix kernel-doc warning Andrew Morton
2021-06-05  3:01 ` [patch 12/13] ocfs2: fix data corruption by fallocate Andrew Morton
2021-06-05  3:01 ` [patch 13/13] mailmap: use private address for Michel Lespinasse Andrew Morton

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=20210605030111.zE60Ybm3T%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=David.Laight@ACULAB.COM \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mm-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).