Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1204530ybv; Thu, 13 Feb 2020 18:05:38 -0800 (PST) X-Google-Smtp-Source: APXvYqyx2s7CeFMnfMhLIXMqD6qn8Da+fxbmREzBNZ8gqGtOq+CKh3WA+oywGlV/OpJFipXmJzxW X-Received: by 2002:a05:6830:1e86:: with SMTP id n6mr396013otr.321.1581645938738; Thu, 13 Feb 2020 18:05:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581645938; cv=none; d=google.com; s=arc-20160816; b=HrG22Ph48XmMxDhpJrEtzPF5j8fZw/jcJWN9LWm5279OxAQjSNeYP6O5BebBoKAcoc EO9XYp3LjSh3C76La52/22QGx0v5mLLrwOE7s5r2OEBgNYLzD0Utx3uAoF/w4WiHnsWm b8RKDrtxkEeWk5B6ty64PRANzMz/r4hvosaMN3uztbcvMugqf1IDf2me5+T1cp5HUXcF AuRUA4A7ZZeKGzHWNBZchJhm99hZkf6VyxSPzvFtY/Da6no4mc8Khw8TKC7lXc7/kW2n H5ePyynyhoYCqz/srsW9z4CmbP6XT54Zt2t4sCu1vVZJSrjqg3sPEsCmqwZ7Z73Hnj24 WLXA== 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=HnK/s2Qvn41yT308PXZyz8HHAPlGswKoPaQCL95dj00=; b=C3eM16K8h07HHd+kFNUgxQuD9/p0npNa85ofDq2yVYo8xpthPzlA9SbuI/mZ0n4zAv oDbZiI0IF9AQ+GfZCe0OBlYK3Wz0Jy/TgbBFfnyXy1kSFYjy3f/sllT2x2b6kKKskR3V ddfhhyvYQ6uxCK0cLrnvZfmSFV4XAjnGgUX3hEtW/VA4BjHoZfIFjxFxQ5UYa6MGXcko qK1DdxIg2c2Jg9s5M2dlxZnXp7UsLiVPpju7b4+1TwKvuLRgh4/hba0N6233w6dA3gIY ngUgDRVqIt3+7Q3td4/nCPXUkeyF0KscQXOiIDzM5rmel8eh6H5Q3pyeERyshRwERuCz aooQ== 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 i5si2085880oif.211.2020.02.13.18.05.25; Thu, 13 Feb 2020 18:05:38 -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 S1728261AbgBNCFD (ORCPT + 99 others); Thu, 13 Feb 2020 21:05:03 -0500 Received: from mga04.intel.com ([192.55.52.120]:62741 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727955AbgBNCFC (ORCPT ); Thu, 13 Feb 2020 21:05:02 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2020 18:05:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,438,1574150400"; d="scan'208";a="434638612" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga006.fm.intel.com with ESMTP; 13 Feb 2020 18:05:00 -0800 Date: Fri, 14 Feb 2020 10:05:15 +0800 From: Wei Yang To: Mel Gorman Cc: Wei Yang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, shakeelb@google.com, yang.shi@linux.alibaba.com Subject: Re: [RFC Patch] mm/vmscan.c: not inherit classzone_idx from previous reclaim Message-ID: <20200214020515.GC20833@richard> Reply-To: Wei Yang References: <20200209074145.31389-1-richardw.yang@linux.intel.com> <20200211104223.GL3466@techsingularity.net> <20200212022554.GA7855@richard> <20200212074333.GM3466@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200212074333.GM3466@techsingularity.net> 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 Wed, Feb 12, 2020 at 07:43:33AM +0000, Mel Gorman wrote: >On Wed, Feb 12, 2020 at 10:25:55AM +0800, Wei Yang wrote: >> On Tue, Feb 11, 2020 at 10:42:23AM +0000, Mel Gorman wrote: >> >On Sun, Feb 09, 2020 at 03:41:45PM +0800, Wei Yang wrote: >> >> Before commit e716f2eb24de ("mm, vmscan: prevent kswapd sleeping >> >> prematurely due to mismatched classzone_idx"), classzone_idx could have >> >> two possibilities on a new loop based on whether there is a wakeup >> >> during reclaiming: >> >> >> >> * 0 if no wakeup >> >> * the classzone_idx request by wakeup >> >> >> >> As described in the changelog, this commit is willing to change the >> >> first case to (MAX_NR_ZONES - 1) to avoid some premature sleep. But it >> >> does not achieve the goal. >> >> >> >> There are two versions of kswapd_classzone_idx() since this change: >> >> >> >> * commit e716f2eb24de ("mm, vmscan: prevent kswapd sleeping >> >> prematurely due to mismatched classzone_idx") >> >> * commit dffcac2cb88e ("mm/vmscan.c: prevent useless kswapd loops") >> >> >> >> Both of them would return the classzone_idx we passed as the 2nd >> >> parameter when (pgdat->kswapd_classzone_idx == MAX_NR_ZONES). This >> >> means if there is no wakeup during reclaiming, we would use >> >> classzone_idx in previous round to sleep. >> >> >> > >> >This is somewhat intended. >> > >> >> This patch fixes the logic by using (MAX_NR_ZONES - 1) for the first >> >> case. >> >> >> > >> >Ok, what is the user-visible impact that is fixed by this patch or is >> >this based on code review only? Please describe the test case exactly >> >and the before and after results. I ask because this area is a magnet for >> >regressions and intuitive ideas often lead to counter-intuitive results. >> > >> >> This is based on code review only. I know your concern. This is an area more >> like art then engineering :-) >> > >Then I'm afraid that until there is a corner case identified and a >description of the impact it's > >Nacked-by: Mel Gorman > Yep, no problem. I am glad if I could get some idea from you. >> Would you mind sharing some idea why we intend to inherit the classzone_idx? >> And for kswapd_order, we would restart at 0 if no wakeup during reclaim. >> > >Broadly speaking it was driven by cases whereby kswapd either a) fell >asleep prematurely and there were many stalls in direct reclaim before >kswapd recovered, b) stalls in direct reclaim immediately after kswapd went >to sleep or c) kswapd reclaimed for lower zones and went to sleep while >parallel tasks were direct reclaiming in higher zones or higher orders. > Thanks for your explanation. I am trying to understand the connection between those cases and the behavior of kswapd. In summary, all three cases are related to direct reclaim, while happens in three different timing of kswapd: a) premature sleep b) full sleep c) full sleep after reclaim lower zone Hmm... I am not sure the difference between b) and c). Looks both face direct reclaim when kswapd is sleeping. If I am correct, direct reclaim here is performed by function __perform_reclaim(). Its scan order and zone_idx is retrieved from allocation parameters, so it doesn't affect pgdat{.kswapd_order, .kswapd_classzone_idx} if I am correct. Direct reclaim do affect the pgdat status. After reclaiming, we may have more available pages. But I am stuck in the connection between direct reclaim and kswapd. Would you mind sharing more light on this part? >-- >Mel Gorman >SUSE Labs -- Wei Yang Help you, Help me