Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4566205ybv; Mon, 17 Feb 2020 01:31:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxtxQmlCyEg8nunXn9dQdSiwuV/EpHZaZYuKLNv4vcM6tOubHZcgZAt0iufmdaR+XHqpgBb X-Received: by 2002:a05:6830:1f1c:: with SMTP id u28mr12018691otg.143.1581931910607; Mon, 17 Feb 2020 01:31:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581931910; cv=none; d=google.com; s=arc-20160816; b=oKfmfcPpmTocJhmnDQp1fo6sbdruG1uMPMmYOGloPcyDHqaUV54/cGlq39mYn1lYy3 bXugorq+ezeQ4djiwhn2ZdkPCbfy+sILoneGSlzC5HP2/IcpqmGuz4bB5FDaAVTIvjw8 Ev+o3u2zYcT91lQwlKEBl/gIMPhHh5MLvx4n82QkEi0Rt5glVBfsZ0O4nuGAgdjTXsXV pGt1Li/I8A5REPdzEM0TB7Fh6MaGUYrN4aMmYdzsI0UodNrNRbcDHHNJsC6Yr9csbykP KxJYRa/Bbkei2dHrePCcAmNr8w/ts2kf58/MEAtAdpbCXVdUth+1cIX1d+wSzEbmaZz8 HGig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=yfbEgRhj2XNfZTWjJfU4ec0xDbzJVHBVQVyxX2XDVls=; b=PNaVVWo7u4kbTMmGRSlW6b0JjB2uGg/jXOLpe7silLFX0YMj+8EuBNzK2GSr/DaIJa 6oO7vrMZBx8l1zG8gqC6+G0TLG6holjrWw0AEEhpT0XBdkOT/HVDao2jh+NX3QZrOJ4M fRLJbAkS2bmu8oCoGCvo17Is7KPcztPM4Fm0XiP85LkzghyElpT24eNUe8YaKtGGB4V2 W7VQWX7Nrdsthq2l2b+/HgdQ1+/Mvi9TgcphXcUv+ICxXacz0Drs0wZnoywZ2IWatowg x1g/Ulf268xqUyozkrxRsJP23kX5p1keUbxVnDU92Sc7+qF8t/6KUxvsc5jRKx4eJaUW Hs+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11si6851762otq.223.2020.02.17.01.31.38; Mon, 17 Feb 2020 01:31:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728859AbgBQJb1 (ORCPT + 99 others); Mon, 17 Feb 2020 04:31:27 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36014 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728773AbgBQJb1 (ORCPT ); Mon, 17 Feb 2020 04:31:27 -0500 Received: by mail-wr1-f67.google.com with SMTP id z3so18807780wru.3 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=IoX/dpKQ4bQob6nTOrjiTdKz93oR0Ql9csmtWhXf4CTe8pfCg+I5wOhrOCJtFeHmpy jC+d4gP1KWDg+Xr1nRmkw5p4Pm0ZD7Mrxp8VQu0b5akEx30Z8ZMHP8oAYHObBbzjUWZW I8xOCUaLlMjLdUPYZAylX0luELkKG72KSbHHCF1IowP92s9uhnnjfzRV6rnz7xiC5jzG y+UpxwOctDBiBVDNvb/ac5goIqctz2ENqzeT2Lf24AJ8TUxt97DaB89MSRT4Rw8Tl8A6 5DpUoZqv5MrBhk9DeOv2fGYLrsj+do/MsQc4OIupCNm0ZU6RY6ft5OL222FRWUfvGo7K R+AQ== X-Gm-Message-State: APjAAAW71zUHa3xbtGmP+hYE4RbUpg7esiJ0JoHiBA9AXBWrqcNg2OVz /m8/HXdKZI3K1mEDNWvgJsFeMPiA 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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