Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2335482ybv; Fri, 14 Feb 2020 16:39:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzKtekxBGj6PdOHQuzy8X5UVr4X2I+5JLbiJX+QwHdvYBXcSn/qiE6UskjkvRYiDF3kunV1 X-Received: by 2002:aca:4d06:: with SMTP id a6mr3700137oib.27.1581727168383; Fri, 14 Feb 2020 16:39:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581727168; cv=none; d=google.com; s=arc-20160816; b=SZdyteZeMz/zkn57lCooCzCbnPOYKYerNQwJmrznSm1YpZz51AHzMBsdRnpNWwEro0 2DJbjsGgHXvzza3I/SSbKeqR9NJcKxQ53oNP8OHklBonYZQfNipPhF77OJy8CVtL99JF m842nvFeo3PQSLpRSNfTafp+E2Ux25Bjht25alotP/WadP97xOQQbDyfHTvVT64tcU/S 1l3zIgL0GMimQY98LuVvaaIzYYrmaiMTpaNEOFFDsZvhMAmHS/3pEVunEMppQC7CnSay /TVjcWR3Sk66ss8cyldSpuAIpP5tv5LBEg9cPvqAHX2YF5RFwyNzfbxwv6+ALgQGj9w6 rXww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=57/9yMpLnawB9KNDzWnuF2zDfwEx9Q00AvXUTJnUSyk=; b=bScnYD1uifvmcHmQPUhBJ3rRvDcLB/hCbg0w1zI9MyGRkobc3QVwSblmFFRwDxmz3U MypSZ1PLRrpPJzDJCCjkZj6aMvwiqvySErFh4Pe+LivKwLJ0ndiIgt9usa0kqVFGoW9g mgUwob1YOiPsvDg16cF1Hpy9sdvG0lTQKCGBW/7zL0ZhGMkc0QFhaiSXor2xTz3hVt1m x0hWm/UgtyoMWb/eOAEeqyDdwVBIAsg/FtGc0AdLUFhtOTJbsXtYfx0bILWhPIgIEZRy T5XnEhOfW23eFBDnS0Ttq/8GI2XjWazKYr+/yun0LMi8QL5ePo+EYoruA/aB4xYfk0BJ YugQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d28si3636065otc.123.2020.02.14.16.39.16; Fri, 14 Feb 2020 16:39:28 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbgBOAhi (ORCPT + 99 others); Fri, 14 Feb 2020 19:37:38 -0500 Received: from mga18.intel.com ([134.134.136.126]:9977 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728032AbgBOAhh (ORCPT ); Fri, 14 Feb 2020 19:37:37 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2020 16:37:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,442,1574150400"; d="scan'208";a="234636549" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga003.jf.intel.com with ESMTP; 14 Feb 2020 16:37:34 -0800 Date: Sat, 15 Feb 2020 08:37:53 +0800 From: Wei Yang To: Michal Hocko Cc: Wei Yang , 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: <20200215003753.GA32682@richard> Reply-To: Wei Yang References: <20200214073320.28735-1-richardw.yang@linux.intel.com> <20200214085113.GP31689@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200214085113.GP31689@dhcp22.suse.cz> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me