From mboxrd@z Thu Jan 1 00:00:00 1970 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=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 97C3BC7619F for ; Mon, 17 Feb 2020 09:31:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6733F2070B for ; Mon, 17 Feb 2020 09:31:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6733F2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F3A086B0005; Mon, 17 Feb 2020 04:31:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EC3746B0006; Mon, 17 Feb 2020 04:31:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8B3A6B0007; Mon, 17 Feb 2020 04:31:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id BC5726B0005 for ; Mon, 17 Feb 2020 04:31:27 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 66EF1180AD817 for ; Mon, 17 Feb 2020 09:31:27 +0000 (UTC) X-FDA: 76499101014.14.drain59_81147077bce00 X-HE-Tag: drain59_81147077bce00 X-Filterd-Recvd-Size: 4864 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Feb 2020 09:31:26 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id k11so18741710wrd.9 for ; Mon, 17 Feb 2020 01:31:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yfbEgRhj2XNfZTWjJfU4ec0xDbzJVHBVQVyxX2XDVls=; b=b0cWL8F2rMsp+op4mPn0yLX9asPEyt9vMDSu3oSEoAzuGwSDyfat29D09isCngtO1X SV1GWvVjFR+E01Iv5+O9DiGeCkb7LW7oeq3ciBxR621LPCWPiOL17qUoocDGArgsbV5h MT3h0bwX8nqrJ2m6NKTsY5j0xnIUHIreX0IeKv42wGpIrUNnIfgkOPtJd7dpGG3jVg5o m4OiHbuKc2C/bl6og8JFh3NGQVlQf40qyf8EEZXlgMEvtJbJZNhc77ybra0DeylGYYTR 5LTvVqVAbJ3f0VR4s/x5c+OGVPJZ4Lm1MxCaJLDoQj2G6V6BQ1B7J2W2Wkca+kImdvvm mRdw== X-Gm-Message-State: APjAAAVAcucoRiD5obSjhxw1nlLLiWqIgvq1vHryL3aYz8qj/v936SLS OV6mEHwi5OBfg9UNUO7stJc= X-Google-Smtp-Source: APXvYqxyrOtSEpBxfGCz2utu7Odnr+3Luhc2eVU7hpep9K3tyuBOgKu7P4cmA4CJR7ZT0q7va1X6RQ== X-Received: by 2002:a5d:5188:: with SMTP id k8mr21017538wrv.151.1581931885780; Mon, 17 Feb 2020 01:31:25 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id y1sm111830wrq.16.2020.02.17.01.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 01:31:24 -0800 (PST) Date: Mon, 17 Feb 2020 10:31:24 +0100 From: Michal Hocko To: Wei Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rientjes@google.com Subject: Re: [PATCH v2] mm/vmscan.c: only adjust related kswapd cpu affinity when online cpu Message-ID: <20200217093124.GH31531@dhcp22.suse.cz> References: <20200214073320.28735-1-richardw.yang@linux.intel.com> <20200214085113.GP31689@dhcp22.suse.cz> <20200215003753.GA32682@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200215003753.GA32682@richard> 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: On Sat 15-02-20 08:37:53, Wei Yang wrote: > On Fri, Feb 14, 2020 at 09:51:13AM +0100, Michal Hocko wrote: > >On Fri 14-02-20 15:33:20, Wei Yang wrote: > >> When onlining a cpu, kswapd_cpu_online() is called to adjust kswapd cpu > >> affinity. > >> > >> Current routine does like this: > >> > >> a) Iterate all the numa node > >> b) Adjust cpu affinity when node has an online cpu > >> > >> For a) this is not necessary, since the particular online cpu belongs to > >> a particular numa node. So it is not necessary to iterate on every nodes > >> on the system. This new onlined cpu just affect kswapd cpu affinity of > >> this particular node. > >> > >> For b) several cpumask operation is used to check whether the node has > >> an online CPU. Since at this point we are sure one of our CPU onlined, > >> we can set the cpu affinity directly to current cpumask_of_node(). > >> > >> This patch simplifies the logic by set cpu affinity of the affected > >> kswapd. > > > >How have you tested this patch? > > > > I online one cpu and confirm the "cpu" is the one we just onlined. > > If my understanding is correct, this is the expected behavior. > > >Also this is an old code and quite convoluted but does it still work as > >inteded? I mean, I do not see any cpu offline callback to reduce the > >cpu mask as all the CPUs for the given node go offline? Wouldn't the > > You are right, I didn't see the counterpart for cpu offline. This is the > question I want to ask. Seems we didn't handle it at the very beginning. > > >scheduler simply go and fallback to no affinity if that happens? > >In other words what is the value of kswapd_cpu_online in the first > >place? > > Some cases may this function be useful. > > If we have a memory node which doesn't have any online cpu, the default > cpumask is not set. After one of the cpu online, we want to change cpu > affinity. > > Or we want to add more cpu to the system, we could allow kswapd use more cpu > resources. Otherwise, kswapd would be limited to those original cpus. OK, so the usecase is when a NUMA node gains a new CPU which wasn't there at the time when the node got onlined. Is this a scenario we really do care about? While not completely impossible I haven't seen a system which would allow such a runtime configurability. Maybe it would be simply easier to drop the callback for now until we have a real world usecase to support it and have it documented. -- Michal Hocko SUSE Labs