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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A50C433F5 for ; Thu, 7 Apr 2022 13:58:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EE526B0072; Thu, 7 Apr 2022 09:58:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 775776B0073; Thu, 7 Apr 2022 09:58:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EFBB6B0074; Thu, 7 Apr 2022 09:58:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 4D4AD6B0072 for ; Thu, 7 Apr 2022 09:58:38 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2D6A421316 for ; Thu, 7 Apr 2022 13:58:28 +0000 (UTC) X-FDA: 79330237896.10.B39ACEB Received: from outbound-smtp03.blacknight.com (outbound-smtp03.blacknight.com [81.17.249.16]) by imf01.hostedemail.com (Postfix) with ESMTP id 5D00240007 for ; Thu, 7 Apr 2022 13:58:27 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp03.blacknight.com (Postfix) with ESMTPS id D16C3C0B94 for ; Thu, 7 Apr 2022 14:58:25 +0100 (IST) Received: (qmail 8699 invoked from network); 7 Apr 2022 13:58:25 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.223]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 7 Apr 2022 13:58:25 -0000 Date: Thu, 7 Apr 2022 14:56:50 +0100 From: Mel Gorman To: Wei Yang Cc: DaeRo Lee , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/vmscan.c: no need to double-check if free pages are under high-watermark Message-ID: <20220407135650.GA20204@techsingularity.net> References: <20220102033129.12913-1-skseofh@gmail.com> <20220106094650.GX3366@techsingularity.net> <20220106125758.GY3366@techsingularity.net> <20220326155022.6pqxcfazjaw47eu5@master> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20220326155022.6pqxcfazjaw47eu5@master> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5D00240007 X-Stat-Signature: jd74bg6hzu3gm16q863yo13jhjr1iubz Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.16 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none X-Rspam-User: X-HE-Tag: 1649339907-305606 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, Mar 26, 2022 at 03:50:22PM +0000, Wei Yang wrote: > On Thu, Jan 06, 2022 at 12:57:58PM +0000, Mel Gorman wrote: > >On Thu, Jan 06, 2022 at 09:03:34PM +0900, DaeRo Lee wrote: > >> > > @@ -4355,7 +4355,7 @@ static enum zone_type kswapd_highest_zoneidx(pg_data_t *pgdat, > >> > > static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_order, > >> > > unsigned int highest_zoneidx) > >> > > { > >> > > - long remaining = 0; > >> > > + long remaining = ~0; > >> > > DEFINE_WAIT(wait); > >> > > > >> > > if (freezing(current) || kthread_should_stop()) > >> > > >> > While this does avoid calling prepare_kswapd_sleep() twice if the pgdat > >> > is balanced on the first try, it then does not restore the vmstat > >> > thresholds and doesn't call schedul() for kswapd to go to sleep. > >> > >> I intended not to call prepare_kswapd_sleep() twice when the pgdat is NOT > >> balanced on the first try:) > >> > > > >Stupid typo on my part. > > > >> > @@ -4406,11 +4412,11 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_o > >> > } > >> > > >> > /* > >> > - * After a short sleep, check if it was a premature sleep. If not, then > >> > - * go fully to sleep until explicitly woken up. > >> > + * If balanced to the high watermark, restore vmstat thresholds and > >> > + * kswapd goes to sleep. If kswapd remains awake, account whether > >> > + * the low or high watermark was hit quickly. > >> > */ > >> > - if (!remaining && > >> > - prepare_kswapd_sleep(pgdat, reclaim_order, highest_zoneidx)) { > >> > + if (balanced) { > >> > trace_mm_vmscan_kswapd_sleep(pgdat->node_id); > >> > > >> > /* > >> > >> But, I think what you did is more readable and nice. > >> Thanks! > >> > > > >Feel free to pick it up, rerun your tests to ensure it's behaving as > >expected and resend! Include something in the changelog about user-visible > >effects if any (or a note saying that it reduces unnecssary overhead) > >and resend with me added to the cc. > > > > Hi, All > > Seems this thread stops here. I don't see following patch and current upstream > doesn't include this change. > > May I continue this? Of course, with author-ship from DaeRo Lee . > I've no objections. When I said "Feel free to pick it up", I meant that I was ok with you taking the patch and putting your team on it. > Mel, > > Would you mind suggesting some cases that I could do to see the effects from > this change? Such as the overhead or throughput? Or what cases you expect? > I don't have any suggestions on artificially triggering it. I had assumed you had encountered the bug in practice and had a test case but it would be ok to note that the patch is a theoretical fix based on code review. -- Mel Gorman SUSE Labs