Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp317165pxy; Wed, 21 Apr 2021 03:53:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu6+8AGEhxE5F/6nF6MAzsKT+t/8+VDdZw+LYmMdfMHpOTwW7iTssvnNlgDu5H3Z62Ij6e X-Received: by 2002:a17:902:9002:b029:e6:c95f:2a1d with SMTP id a2-20020a1709029002b02900e6c95f2a1dmr33743465plp.79.1619002419348; Wed, 21 Apr 2021 03:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619002419; cv=none; d=google.com; s=arc-20160816; b=E0VHV6HcJlxEXaocIKo3/OdZulBvWfDrsglBMToshDNpybbQ8r2vsK0R9fNHVcELvt AEyQmKaqtstel6xM+1ygYtE8ZHxruiF5xOLxaTZXI6+QxlNIxY7U4rtFDGLWPTqEar25 Vltd8h/v9WJzRu1Nnxzg0BdckOLlEdUu4EgFVHVXAoWnwAccIGs/UNwYsYImwjOnhdcT BL56NqWbcu8PXGkLG54sLrnhBzOc5KmTsYvIe/n0itEQtfjl+69s2s68yfiG/+FKkk9x Y1TruXylQx0fUIET3j4qQ3RXUSlsXgLnbXeTaOexXPtBmfQAHhkfMKqLwrx5LJSCRnHe Hgvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=958qgNOMMQHBKiudXbOhYcKipML0hl7ML/vSp0CTCqA=; b=Tz/6632Ekotvn+Zle1V64WgY6Aknp53yCCom3jmcqDqvLS7aMZcaOdOipgsOuYrXP/ ijdeUkbBe5WCQjGj/IzlyLN3VQbeikrseYQeMmqkQegd4tA73422dwMOqdECFaEb59c8 OGWeT6gTu3m1zSl5zL+BenIcIryALFCuKm+TJduRps8vU52MOstyjob93j8G7SQ0YHBs UtIn2cCov9uDqaTQhs05xb3bN8DxHy+keBaKwmvyWYWe+3ass6n1HtR6hdUgQSHsQyyg I4AQU0On3MgPJEiZKLqJN6k68Z2LhCI4XClhPRCjfbBDuorF/m/OPezvTcpqCtHGjaoH r0HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="e4RwU/x5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si2015234plc.189.2021.04.21.03.53.27; Wed, 21 Apr 2021 03:53:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="e4RwU/x5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236646AbhDUKws (ORCPT + 99 others); Wed, 21 Apr 2021 06:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236099AbhDUKwr (ORCPT ); Wed, 21 Apr 2021 06:52:47 -0400 Received: from mail-wr1-x449.google.com (mail-wr1-x449.google.com [IPv6:2a00:1450:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0058EC06138A for ; Wed, 21 Apr 2021 03:52:09 -0700 (PDT) Received: by mail-wr1-x449.google.com with SMTP id 91-20020adf92e40000b029010470a9ebc4so11392502wrn.14 for ; Wed, 21 Apr 2021 03:52:09 -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=958qgNOMMQHBKiudXbOhYcKipML0hl7ML/vSp0CTCqA=; b=e4RwU/x5IzvdYtTruaVeAg8cfueMN5BJshXP8pv9Q+HnHtMBceFhACbcGE3soTOgpc trfZnV8dj77WSwGo0mkof3682PcrXAe+cVxI+/m2NWIC1pub3IEPhtD1qmNQ7jjfPkCS T76lyZLUX2V04rWtEHo/QifvHBRgKzwvNsL0sd4zjsNvAmOr+HvyE1kX/KeinDOfBIgx ENPqRwZKBIE0UTLq9iWBGJje4ZMwFlI1DZog/3pA2vE55gaIkzs+mmQ196mp8PYqEcfq 2/b/UCfHKASERuiv1Os5WDJ1UVqNfafFoz+HPmG/8SG6cvVkPY8Ixp0S0ando9EZoGua Bg8Q== 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=958qgNOMMQHBKiudXbOhYcKipML0hl7ML/vSp0CTCqA=; b=l72/6K+3QyQtTtwhVS+L4r28zVbuDjIuyp3Xntg5t8A5iuX3ixQrQj+f7bEZZmFwYG DvZl3he3gTgjABlFGULcrXRAVxMgcP8xYqszZsFr5JhyJr0uRVnOGy5xGHwotde/fjRe m8NgEHqpT251Az/kkQqDSuv0qbyEHgNNdXlu3nkDvX7Vybjhva7vawIu7x7hM5oOKprL lmpjpNdxxD400tMUT0YPHFOWOztVpRFWO4XFceDQjcq1Wqpo4IgcAmL5+LnlrHNDupAi QAhhU5+Xjvra/8xm3quAnUY7eT/5WsPfsoF6z6hxheobmO+JbruKn/WLbdNl3+UKGDkC p78A== X-Gm-Message-State: AOAM531KbYpBrTSYDW03TVmjMi0VsOd7s8rrzyL3SdkPkA6TtCZPcqBQ qwr7N7XSVVmQnLfsFhVCI4TQWZuFBQ== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:c552:ee7c:6a14:80cc]) (user=elver job=sendgmr) by 2002:a05:600c:4fd4:: with SMTP id o20mr9476694wmq.166.1619002328581; Wed, 21 Apr 2021 03:52:08 -0700 (PDT) Date: Wed, 21 Apr 2021 12:51:32 +0200 In-Reply-To: <20210421105132.3965998-1-elver@google.com> Message-Id: <20210421105132.3965998-4-elver@google.com> Mime-Version: 1.0 References: <20210421105132.3965998-1-elver@google.com> X-Mailer: git-send-email 2.31.1.368.gbe11c130af-goog Subject: [PATCH v2 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, hdanton@sina.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 9742649f3f88..e18fbbd5d9b4 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -636,7 +636,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); @@ -665,7 +666,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)); -- 2.31.1.368.gbe11c130af-goog