From patchwork Mon Apr 19 08:50:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 12211219 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.3 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 46A80C43460 for ; Mon, 19 Apr 2021 08:51:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D483261107 for ; Mon, 19 Apr 2021 08:51:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D483261107 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 6C6A06B0071; Mon, 19 Apr 2021 04:51:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 69D796B0072; Mon, 19 Apr 2021 04:51:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 564E26B0073; Mon, 19 Apr 2021 04:51:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) by kanga.kvack.org (Postfix) with ESMTP id 3DD436B0071 for ; Mon, 19 Apr 2021 04:51:03 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F07E7180AD830 for ; Mon, 19 Apr 2021 08:51:02 +0000 (UTC) X-FDA: 78048496764.25.DE82D4E Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf21.hostedemail.com (Postfix) with ESMTP id 3AC8CE000108 for ; Mon, 19 Apr 2021 08:51:00 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id v65-20020a1cde440000b029012853a35ee7so3835716wmg.2 for ; Mon, 19 Apr 2021 01:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=p3g1jw5/hGDj5wABho0AViDXSgtC45K4NGeFzanUCY4=; b=i3pEmtzl9Y9yr4qP/FhB0UAxWQWx/TnwZWDJLCOZjiYThK2wDLH3szcJMq2jBHWGJx 8lFlpz7eCUTbgNuCkNQ/hQMlCZlFckio/wKwBGDbzGmVMwZfhRiNgrp6fhGIvchgW4CT XgW3GA3rjsfNWlg9Ak/qghjRMZzJTTPTZLC15L+71r2yQ3d3x1dJieJjnmrHUfKPvHNj 80c1OeguGlK61udIO/VqiVdPCwrOzA1MVB00mGpwxLMHiPLokUL6rHh3h8K54EZ+5jQV Xj4CaPbXrHqInHKQL3DbmVxUm4bBEvj4y0mZRN14HGYW1CSp8X4Tf/Z/yJ7JMQNTcAoS 9EFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=p3g1jw5/hGDj5wABho0AViDXSgtC45K4NGeFzanUCY4=; b=ZzLE78Fp8P/dcQng+0OAzNReswPW0R2kZU3CanORv4Sb57jxvfiB8pJaq6ma+XBVO8 aCfLW+GGNJKoYZ7Q6RJJmB+iPfIk1HZmN7/ByVCzP8wb05FbCNNFSa8amntksE7bN0t9 9k0oZe2sq8yawYh3dBBKrWP5XOK2WDEvsMejOKFR0noRfc+MSvVqpZzHYmxQmRm2ne7h s9a4b+WUoGFd0Phwz/LWEgK3UnKEAdIrttlfYkdUFuMp0dwmWNZhCq5AD6DHDfGt0yMA jSXEaODpZsBQK84t6sq1fAOYY1Eo2iMggWg1pFGmRGORKEIL1D8ZjjPii5BswZWG6QBq WdlQ== X-Gm-Message-State: AOAM531hsmKzReFWdskeRhzZz7zqn2ZkTs14Lnp/uKlhEoTfPoR78IgR 0/fifnmGFj4DiQpx9duTYGMnhbvO1w== X-Google-Smtp-Source: ABdhPJw7p0IZNRzHEhoYVbNtBdDWX3bV3Cz4INszTsP30Q+/zUXpsgM1fhE69590WodfIcGOTAxlKDhPmw== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:92f8:c03b:1448:ada5]) (user=elver job=sendgmr) by 2002:a1c:4d0e:: with SMTP id o14mr20041525wmh.141.1618822261465; Mon, 19 Apr 2021 01:51:01 -0700 (PDT) Date: Mon, 19 Apr 2021 10:50:27 +0200 In-Reply-To: <20210419085027.761150-1-elver@google.com> Message-Id: <20210419085027.761150-4-elver@google.com> Mime-Version: 1.0 References: <20210419085027.761150-1-elver@google.com> X-Mailer: git-send-email 2.31.1.368.gbe11c130af-goog Subject: [PATCH 3/3] kfence: use power-efficient work queue to run delayed work From: Marco Elver To: elver@google.com, akpm@linux-foundation.org Cc: glider@google.com, dvyukov@google.com, jannh@google.com, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 3AC8CE000108 X-Stat-Signature: 3338sd7w7bpce78ortg1t7kxjmxhihia Received-SPF: none (flex--elver.bounces.google.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from="<3dUR9YAUKCPwipzivksskpi.gsqpmry1-qqozego.svk@flex--elver.bounces.google.com>"; helo=mail-wm1-f74.google.com; client-ip=209.85.128.74 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618822260-915166 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000049, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use the power-efficient work queue, to avoid the pathological case where we keep pinning ourselves on the same possibly idle CPU on systems that want to be power-efficient [1]. [1] https://lwn.net/Articles/731052/ Signed-off-by: Marco Elver --- mm/kfence/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 73e7b621fb36..7e20cd9690a2 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -642,7 +642,8 @@ static void toggle_allocation_gate(struct work_struct *work) /* Disable static key and reset timer. */ static_branch_disable(&kfence_allocation_key); #endif - schedule_delayed_work(&kfence_timer, msecs_to_jiffies(kfence_sample_interval)); + queue_delayed_work(system_power_efficient_wq, &kfence_timer, + msecs_to_jiffies(kfence_sample_interval)); } static DECLARE_DELAYED_WORK(kfence_timer, toggle_allocation_gate); @@ -671,7 +672,7 @@ void __init kfence_init(void) } WRITE_ONCE(kfence_enabled, true); - schedule_delayed_work(&kfence_timer, 0); + queue_delayed_work(system_power_efficient_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));