From patchwork Fri May 21 11:16:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 12272923 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 A5C23C433ED for ; Fri, 21 May 2021 11:16:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2119260249 for ; Fri, 21 May 2021 11:16:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2119260249 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 A3F378E0032; Fri, 21 May 2021 07:16:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9EF5B8E0022; Fri, 21 May 2021 07:16:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B7B68E0032; Fri, 21 May 2021 07:16:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 59A7F8E0022 for ; Fri, 21 May 2021 07:16:40 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EC915181AC9BF for ; Fri, 21 May 2021 11:16:39 +0000 (UTC) X-FDA: 78164985318.24.B38DAE6 Received: from mail-qt1-f202.google.com (mail-qt1-f202.google.com [209.85.160.202]) by imf23.hostedemail.com (Postfix) with ESMTP id 6C3CEA0001DA for ; Fri, 21 May 2021 11:16:37 +0000 (UTC) Received: by mail-qt1-f202.google.com with SMTP id j12-20020ac8550c0000b02901dae492d1f2so15161541qtq.0 for ; Fri, 21 May 2021 04:16:39 -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=+QJiicZEZmfMKgY/pq0Y5eLW/e6KZlrhFiiHdcX6gWY=; b=SjYh/4Oeno4AVQ0LwbsTcjYcJhcRTY8VWO6h6DlXv1OFswWLALLNIR/vEtKlhnEdPs MCNA5RMMnbZHlIANEoFDu9Pwx7BSo8eKYUy+1vV1vUIzqUegkp7vtXmPkueRrzloFTQg wVA/VTcVXcHnUSMW9y4DRGbNKo6HSxGmzfwzoL/yxa5YwNyd8IkkbjfrgArikfvvMCyD QrRekNbh+rZ7OhaUbrG12wGY22bY/466IoKcv/cQRtqbTD2aCiXx/is7OwXUirgi0AGg C4RFrAVAxl9uvLGbYGcNhWbfac1BXCTzaveSGd9yK8XxMuXxFlUZJ060JpZ1I1iN8vFg 2hpg== 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=+QJiicZEZmfMKgY/pq0Y5eLW/e6KZlrhFiiHdcX6gWY=; b=HvdT32TQLzn66f4WVM1vSUT3HKneRqnMtV6gLW5sqgerhy96wAPl846Y5LPxSflWK7 wssVak5yB/0eGygSQQ0PRKk4BYwoNhVC7ryrvCNM4qPc5S72y23hlTpZkYfSADZx93Cx HaQVvOz0Okb4ddxZcDStwmn5f6VmVT5Pw179Vw+Ooal5Jj3mxpWjyUBagSLl/eAJ8GiY y4z8Uj8gF3xDaEsyjg9l3SE7F9TQH6dfE/qZBBFrrj4KKvzFh+79Iax+t8TgtWe0MQwD XvvoPZwDzYLNxj4v+QQa+WvMrDvvQYu1wHAYQIj+Yqsbj2L4ULyRYD3qFoKw1TkFTovW 7Wxw== X-Gm-Message-State: AOAM531Ba2MhNRdRGuELuW/hEfeF3Z4l69kfpLZEcTyuRswycHu1EOz9 bwW7BBTsKcSmyxY7TfM1bcVgO43uVA== X-Google-Smtp-Source: ABdhPJwhXZ66s93o3N9GuOPp1PuhXBp5f6gVrIaPsVNiGS/i/YTpzrfxUWA9DXyLPx2iWgJOArZQbbfPhg== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:a932:cdd6:7230:17ba]) (user=elver job=sendgmr) by 2002:a0c:ba0c:: with SMTP id w12mr11900436qvf.41.1621595798787; Fri, 21 May 2021 04:16:38 -0700 (PDT) Date: Fri, 21 May 2021 13:16:30 +0200 Message-Id: <20210521111630.472579-1-elver@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog Subject: [PATCH] kfence: unconditionally use unbound work queue 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, Hillf Danton Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b="SjYh/4Oe"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of 3lpanYAUKCG0PWgPcRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--elver.bounces.google.com designates 209.85.160.202 as permitted sender) smtp.mailfrom=3lpanYAUKCG0PWgPcRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--elver.bounces.google.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6C3CEA0001DA X-Stat-Signature: kecgoaq64u8qiqnbto5ibde1mhj6z31z X-HE-Tag: 1621595797-560928 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000016, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Unconditionally use unbound work queue, and not just if wq_power_efficient is true. Because if the system is idle, KFENCE may wait, and by being run on the unbound work queue, we permit the scheduler to make better scheduling decisions and not require pinning KFENCE to the same CPU upon waking up. Fixes: 36f0b35d0894 ("kfence: use power-efficient work queue to run delayed work") Reported-by: Hillf Danton Signed-off-by: Marco Elver Reviewed-by: Alexander Potapenko --- mm/kfence/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 4d21ac44d5d3..d7666ace9d2e 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -636,7 +636,7 @@ static void toggle_allocation_gate(struct work_struct *work) /* Disable static key and reset timer. */ static_branch_disable(&kfence_allocation_key); #endif - queue_delayed_work(system_power_efficient_wq, &kfence_timer, + queue_delayed_work(system_unbound_wq, &kfence_timer, msecs_to_jiffies(kfence_sample_interval)); } static DECLARE_DELAYED_WORK(kfence_timer, toggle_allocation_gate); @@ -666,7 +666,7 @@ void __init kfence_init(void) } WRITE_ONCE(kfence_enabled, true); - queue_delayed_work(system_power_efficient_wq, &kfence_timer, 0); + queue_delayed_work(system_unbound_wq, &kfence_timer, 0); pr_info("initialized - using %lu bytes for %d objects at 0x%p-0x%p\n", KFENCE_POOL_SIZE, CONFIG_KFENCE_NUM_OBJECTS, (void *)__kfence_pool, (void *)(__kfence_pool + KFENCE_POOL_SIZE));