From patchwork Tue Sep 21 16:13:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12508165 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 7AB45C433F5 for ; Tue, 21 Sep 2021 16:13:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2ADBE61214 for ; Tue, 21 Sep 2021 16:13:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2ADBE61214 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DD3866B0081; Tue, 21 Sep 2021 12:13:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0CA56B0082; Tue, 21 Sep 2021 12:13:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B86F86B0083; Tue, 21 Sep 2021 12:13:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id A98326B0081 for ; Tue, 21 Sep 2021 12:13:47 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 764BB24398 for ; Tue, 21 Sep 2021 16:13:47 +0000 (UTC) X-FDA: 78612076494.26.90A303B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 1E814600198F for ; Tue, 21 Sep 2021 16:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632240826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zqnAk8CEPT4G20qz1UpPoVf1omLqowS17E+dGhKhwuM=; b=EmohStatTcPutgZHeYBRv5AvqAoSSuZ8BxOGcs8s9I5dqvZ2UknUvRizd29KyDTeWDAlHG eIQymN1cI+J1q43J0LWPQhNIjtxkuK8DsQgbOPeKz1sSogR7aKO1BH7/K12qgF+tNUis+1 uZLPs7QTj1enDheN3zO4fBqsuhiATpQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-589-p3BoXyvhP7Wa1rGKMKqmnA-1; Tue, 21 Sep 2021 12:13:43 -0400 X-MC-Unique: p3BoXyvhP7Wa1rGKMKqmnA-1 Received: by mail-wr1-f69.google.com with SMTP id r5-20020adfb1c5000000b0015cddb7216fso9266901wra.3 for ; Tue, 21 Sep 2021 09:13:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zqnAk8CEPT4G20qz1UpPoVf1omLqowS17E+dGhKhwuM=; b=aYO8x7FVdDMvJl+e629doXi2+smGBchepZ26UXT1/4aebDnI6OOsGrrE7mwAVrCDFs +oe2XAMZVNjxz3NoZDtfQrqHmScuuofIHdMXq1JYCciWoPZPC2LpTRgF79U4335IQPLO L3wdxfvS6qb4KFX1UZzTcY+myhXXDce27+JZmYxrnuXTuypUcE4oJG/CrQVx+BzkRpqL 1Lh/f9itFKtnPVGpodB6sTO0kgVF71T8TCZ9qNWbDxkB4/G5VL6Gh4pe8cnntDcIEtPK eOcnRufN/scnPCPNjBkh9Lm0iwrqBsPtzDNV5MQZMrbs9rIzWX6y7nUCmBgWdPjoMSmz F0kw== X-Gm-Message-State: AOAM530ICuCwS87dgH9IOnLyesZ09L0VOnTiGk11N7kh/LnHippU08Pq 2pZ2VAy77F6O7y9B8bl2tulIrWzTCQVusYQjozCq1Sn3P4lhv9UXYiAJNO8et4cDgafaaSGVpmG 78jlbrQv6nUU= X-Received: by 2002:a5d:510b:: with SMTP id s11mr35121609wrt.79.1632240821967; Tue, 21 Sep 2021 09:13:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2JyQmA+xjBWA1pYPhaUZl3UgvqGOZtEA5D9vdOoOLPYTSVO682BJB72/4LybppWdkc2NU+A== X-Received: by 2002:a5d:510b:: with SMTP id s11mr35121588wrt.79.1632240821777; Tue, 21 Sep 2021 09:13:41 -0700 (PDT) Received: from vian.redhat.com ([2a0c:5a80:1d03:b900:c3d1:5974:ce92:3123]) by smtp.gmail.com with ESMTPSA id t1sm19786477wrz.39.2021.09.21.09.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 09:13:41 -0700 (PDT) From: Nicolas Saenz Julienne To: akpm@linux-foundation.org, frederic@kernel.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, cl@linux.com, peterz@infradead.org, juri.lelli@redhat.com, mingo@redhat.com, mtosatti@redhat.com, nilal@redhat.com, mgorman@suse.de, ppandit@redhat.com, williams@redhat.com, bigeasy@linutronix.de, anna-maria@linutronix.de, linux-rt-users@vger.kernel.org, Nicolas Saenz Julienne Subject: [PATCH 6/6] sched/isolation: Enable 'remote_pcpu_cache_access' on NOHZ_FULL systems Date: Tue, 21 Sep 2021 18:13:24 +0200 Message-Id: <20210921161323.607817-7-nsaenzju@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210921161323.607817-1-nsaenzju@redhat.com> References: <20210921161323.607817-1-nsaenzju@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EmohStat; spf=none (imf10.hostedemail.com: domain of nsaenzju@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=nsaenzju@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1E814600198F X-Stat-Signature: 6fawmrdqd1wkxfr4gwq7fqn5c7a7jhaf X-HE-Tag: 1632240826-187222 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: When enabled, 'remote_pcpu_cache_access' allows for remote draining of mm/swap.c's per-cpu LRU caches and mm/page_alloc.c's per-cpu page lists instead of using per-cpu drain work. This comes at the cost of more constraining locking, but NOHZ_FULL setups need this nonetheless: processes running on isolated CPUs are sensitive to any sort of interruption and preempting them in order to satisfy a housekeeping task is bound to break their functional guarantees (i.e. latency, bandwidth, etc...). So enable 'remote_pcpu_cache_access' after having successfully initialized NOHZ_FULL. This is based on previous work by Thomas Gleixner, Anna-Maria Gleixner, and Sebastian Andrzej Siewior[1]. [1] https://patchwork.kernel.org/project/linux-mm/patch/20190424111208.24459-3-bigeasy@linutronix.de/ Signed-off-by: Nicolas Saenz Julienne --- kernel/sched/isolation.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 7f06eaf12818..4fc4c76f27ab 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -8,6 +8,7 @@ * */ #include "sched.h" +#include "../../mm/internal.h" DEFINE_STATIC_KEY_FALSE(housekeeping_overridden); EXPORT_SYMBOL_GPL(housekeeping_overridden); @@ -137,11 +138,17 @@ static int __init housekeeping_setup(char *str, enum hk_flags flags) static int __init housekeeping_nohz_full_setup(char *str) { unsigned int flags; + int ret; flags = HK_FLAG_TICK | HK_FLAG_WQ | HK_FLAG_TIMER | HK_FLAG_RCU | HK_FLAG_MISC | HK_FLAG_KTHREAD; - return housekeeping_setup(str, flags); + ret = housekeeping_setup(str, flags); + if (ret) + /* Avoid LRU cache and mm/page_alloc.c's pcplists drain work */ + static_branch_enable(&remote_pcpu_cache_access); + + return ret; } __setup("nohz_full=", housekeeping_nohz_full_setup);