From patchwork Fri May 21 08:32:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 12272353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BCF9C433ED for ; Fri, 21 May 2021 08:32:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E7EA7611AD for ; Fri, 21 May 2021 08:32:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7EA7611AD Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 79CE88E0025; Fri, 21 May 2021 04:32:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74E968E0022; Fri, 21 May 2021 04:32:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C5EB8E0025; Fri, 21 May 2021 04:32:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 2A3DE8E0022 for ; Fri, 21 May 2021 04:32:21 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BC527181AF5C3 for ; Fri, 21 May 2021 08:32:20 +0000 (UTC) X-FDA: 78164571240.07.C27A107 Received: from mail-qk1-f201.google.com (mail-qk1-f201.google.com [209.85.222.201]) by imf20.hostedemail.com (Postfix) with ESMTP id A5D2C2C0 for ; Fri, 21 May 2021 08:32:17 +0000 (UTC) Received: by mail-qk1-f201.google.com with SMTP id n2-20020a37a4020000b02902e9aef597f7so15466226qke.21 for ; Fri, 21 May 2021 01:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=eNYE7zpSOCj7plZZAyS+5aDrL5u+MfadoSDP0vm8/WQ=; b=XraWczXc5cxxOBDBtVGGfGFtPPc7wcCkrF3GfJOY2jod0PMBW5S0idtcykIynrztOj /8GPrUQbzqot1wTmeVWAetIzkEZC1/S5Vu+rB42C87I91OCbcj4/QLTjHI/aPfJDdCTP EKWcZBs9XSVgYlFXMB5dMLRsOVyVLy1EghdzRqGbvvRj7PdWjT2UdYdOPZixtq183drw ZFueMNvZ81RSFOJAehdyIKbW1168dtTXlz3Sfc+dU3I7Xj+0sk4N9kJkIhPwY56OJTjE 0sotraP2uChwuL7Oo1h5ZZT6BV+qihPMQ9SFXO73vCLDONZnkh/H0+3yWIa8J4paZ8pA 5BCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=eNYE7zpSOCj7plZZAyS+5aDrL5u+MfadoSDP0vm8/WQ=; b=Wd0AnSC3qEuIOFaYpQxUBotBfeOdca5Wf7gEO+IqaXfrqSicLGzYrGLd+yk4moBp8g pEdoSgkGPl98mMGSC4PSSVoKrIEpCWDmOP37uwU4rsL4/z2zf3CvsO6iULrLiUMBkDXF A2Os7JhZxdwIkJmevzPO1pKu0NpCsoTmRwKoRUNoQwvnaCl3hej0aPZYFXjv3SYQyW1R ZlqYV3WsfcO2s4ZlvWEuifK39QC6vwnaqPvl8BQ6dRKNiIVt2sNpbez8HlqVHJ7iTQqS EACn7Wp+v8JhYp0w8xNmPEef5euImFh6gLdX1mlFlhZNgdws5l83RzF6nbhpRkykpaRh UnRA== X-Gm-Message-State: AOAM530GnG/cqf5VfwqqSccZejOpfPmFRmEqRrCSbkSrM+SoD9rhPlaC P6ITSTWGy46LDVa9qMN5dzoA+LY8iw== X-Google-Smtp-Source: ABdhPJxOtHW/s436pbUSNtX/1MJ9ezmdnT2dciQSffLNozLx/dfNTPZEQC900wdnfyRocBsiRRPvt7cIHg== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:a932:cdd6:7230:17ba]) (user=elver job=sendgmr) by 2002:a0c:dc07:: with SMTP id s7mr11433864qvk.26.1621585939685; Fri, 21 May 2021 01:32:19 -0700 (PDT) Date: Fri, 21 May 2021 10:32:09 +0200 Message-Id: <20210521083209.3740269-1-elver@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog Subject: [PATCH] kfence: use TASK_IDLE when awaiting allocation From: Marco Elver To: elver@google.com, akpm@linux-foundation.org Cc: glider@google.com, dvyukov@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, Mel Gorman , stable@vger.kernel.org Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=XraWczXc; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of 3E3CnYAUKCJwAHRANCKKCHA.8KIHEJQT-IIGR68G.KNC@flex--elver.bounces.google.com designates 209.85.222.201 as permitted sender) smtp.mailfrom=3E3CnYAUKCJwAHRANCKKCHA.8KIHEJQT-IIGR68G.KNC@flex--elver.bounces.google.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A5D2C2C0 X-Stat-Signature: kemrn5r7ppot7trfgi117r7kwexueqsy X-HE-Tag: 1621585937-668183 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Cc: Mel Gorman Cc: # 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. */