Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2865367pxb; Tue, 21 Sep 2021 09:17:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGSI0+Kh7/kMyeu+den2xhsmJzh8XUyYwbX/yD9N4JLdSLpJyMHWYH5VYcNK3Z9NVoW/zU X-Received: by 2002:a17:907:c22:: with SMTP id ga34mr24163458ejc.336.1632241047448; Tue, 21 Sep 2021 09:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632241047; cv=none; d=google.com; s=arc-20160816; b=estuxBjyJS6GTMqMh3q7SPIqXYJpXYWpqmblr4PwA3ocfmYlJncJr+a0hUoIoSqRX2 BmDWQZSlqgx+/lS0bKv+3cu+WzZsUxNphqiA2MfKVjJjhGnYRAKYF68sFHOpeW2PWaJ4 hIKTKawZsLJDiGnM1OBSzzZT4iO3R7+t4gcZ0HyTq1wy3GIE1AEFulEIcSavuW03BwW/ oK5CX4wLCmdz51c+wVCxYXRlYf+/eairLuK1QkaeVEssRNiML08hBQn69A29zU1W1OgP 3Z90akKCPvoIDOAqyYPbL/hcGyHThW/ISsVmalsn4jDyGxyAXMepIW6Lm2R5s0sAjgdD oIsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zqnAk8CEPT4G20qz1UpPoVf1omLqowS17E+dGhKhwuM=; b=C5OpxwYLmyqVQ9rMS8ybzD3a3UIu3Ug8hsj0E3JkXIeZNXW9cFuxdXQbg7e0LVUcNQ mnD1tQS1AejTCqvccFFMWtnqhTE2FAIL5adJskDVgqpYjzZUb8JDJwKdG3iBIAUnAOxK ujw+DtpRVxQ8kYK7RxAdowOjjCTNbDGV1758sLggibjvCqFuQSt35CPTicQpQuDZahHe AwODnQGnnMpqRtYsp3FZ9N+afmijsNaJqxvMA9OvGPPxuU7QUHGEGms0qMeQvlIylQZG +Gek+nxrXY8BGcjh13Yd6E8D/RTeUBNG4U9Ntm5zR3O0z2h/XTRKfLaZtGEqT7G8dv42 XhmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SnfSuRXg; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si19797627ejk.622.2021.09.21.09.16.57; Tue, 21 Sep 2021 09:17:27 -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=@redhat.com header.s=mimecast20190719 header.b=SnfSuRXg; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234372AbhIUQPZ (ORCPT + 99 others); Tue, 21 Sep 2021 12:15:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39830 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234360AbhIUQPN (ORCPT ); Tue, 21 Sep 2021 12:15:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632240824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zqnAk8CEPT4G20qz1UpPoVf1omLqowS17E+dGhKhwuM=; b=SnfSuRXgNGTyqVjnsgUSNlHAJCc/Lkoi5nV79FrqR7bDrwBBLRK+GCmeNCeY5OaXCn2MaH Nt7P8hZBcSXgOXYkMVjXotbjEbPuR1iSZFgcjnbm1FcKu2a01QDy2VW8Gi8YntqwhVwVDg 1Qxl7xZrRpEtAGiraWCuoGXVZ3d5CVc= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-decNi3qqPriVQzFyCQtC8w-1; Tue, 21 Sep 2021 12:13:43 -0400 X-MC-Unique: decNi3qqPriVQzFyCQtC8w-1 Received: by mail-wr1-f72.google.com with SMTP id s13-20020a5d69cd000000b00159d49442cbso9252108wrw.13 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=PWSb6ZjNfMykI1+dzjQdifiCSTr1FR08MiDYmJxD6hv79UDo/Kr59iqLJbynfPgB+A +shZMvq8O3+9rg8UArIXckyeJC0LF46k8ukurvr3lp6CIx8yTqyiRvUMaUOUc+cGk1nj RGOQvJxK9WkBmohTeHeBulOEtxEUnP7OvDk/okMaHbJV/xRepWaggpuAEwmXQ7mw7IXf IUIXlFy5wjMr8Gzf8LcXgK4vHD9IAfLI4mZnGoHRuwMiD4YBPF08iEEK86QfGmSOT3g5 97Squkh3ha6C1C+GmPwI68Xj1WV6lELBWyEt87Ga46r9H6TK6hJtM9aJbdg5ELIQm2jf JnTQ== X-Gm-Message-State: AOAM532X6MKw8XEYHA868q2oPaD8YeG0s/GdO0Y3rxIfdmWA6W+PZIyO EeFC+NpWN7s7q8G5Ju23nP9iVTqF+wAXzCGDEylt6HHrgfPe9BlYyvYu61eFdNrMQfyCkW3unpd UMh3vM2iGFVFkWZpF/crE0Wz0 X-Received: by 2002:a5d:510b:: with SMTP id s11mr35121620wrt.79.1632240821968; Tue, 21 Sep 2021 09:13:41 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.31.1