Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1432492ybv; Thu, 20 Feb 2020 20:23:23 -0800 (PST) X-Google-Smtp-Source: APXvYqz9qgv+8Qu5xB4KI8ikczfnLOjfGU4BPUoy0RrzLUoOrDEwXiEuHfsa/F2xGbZ5VMSmba9s X-Received: by 2002:a05:6830:2102:: with SMTP id i2mr25766237otc.123.1582259003080; Thu, 20 Feb 2020 20:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582259003; cv=none; d=google.com; s=arc-20160816; b=kK4WAgyVLvBywA7H+mUzycEIhybPk/d8BUnhSc9pRED2c6HzOHkYxb2CCZw/910Y69 SIJAFXB39quOXpbcVxyfMnulQg602aznZVwgMVFD8zEzkawmR4MW+KcYzFKCfrtqzdF+ 05yG/QeUb90JY7iZ+sWor2Qg4bn2m4jLdvJ/qMh9lFOPdp0TLyD3WF1UlWoLtwDRo4LA XjHNFsB8+47jxF5qnZy912vQWv9nGyzkuvCKxkBwZJcv6/xxOdO0AgYgpDPKQIai828m MHnRDi1aAO6bjwLFeGEwtu2Cs9um5kGixXgxIlTRuEFZ26CvQgrm+4cUxYEVS6IT+8t7 Q8pQ== 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=ju/zaBpvWAo0tPrtMvrLc+tZUkDMjmmyyQeZUswt94Q=; b=gT80KTcujfTppKUL2RHhGTUD2m3560e5FCK+qFEb2MCIcTv1UmV0BuF1AKHPJqJyr4 vR+rkwM9ct3rk/Rggu7gBSBKBmS8FcXUF6kIACWQvb6SeYg0/c7+fwa8Xa8Q3hbj7HbS IZyjUclH2ufOz8n+bkWn2zuRJN3H4Z0w4JrQO2KNU8ItlBz+X2TQOqNORpU2v6hYNpPX cHcW0JWb6o9cvoxmHoQYM2mxCZ9imgM8+OVCBlwd1Wjc/7JRMnbVuH0NoXziicIYzFGA zc3BhhzVakK7Ib+CqJKTP3dGDjeUkEy8BDoM64Zb9s2NPW2dovzcvhC9Z8jj7ae2RUmD i/3w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r21si811096ota.204.2020.02.20.20.23.10; Thu, 20 Feb 2020 20:23:23 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729585AbgBUEWg (ORCPT + 99 others); Thu, 20 Feb 2020 23:22:36 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39076 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729280AbgBUEWg (ORCPT ); Thu, 20 Feb 2020 23:22:36 -0500 Received: by mail-pl1-f193.google.com with SMTP id g6so312158plp.6 for ; Thu, 20 Feb 2020 20:22:36 -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=ju/zaBpvWAo0tPrtMvrLc+tZUkDMjmmyyQeZUswt94Q=; b=rZxNS5XJBI0Pj02HTyzBQrCNXXMfYNSE6DqEQ8ba7WCOJEkITPxUcrjbshEP9McVK0 S8utzMZ7Es0kIJ+/34sZlWhol1vZ9F/pSQO7mUR9BC7YZFN6Imxgf1/QlC5nILnVKCcw C/Pjv/vfs0wXIr2X3DwAYRNJv4HNGQ5zORj6YGw2FlX8r6opGOOQ63+fnOoBaqQLYcwk V7/wYmkrq088CrHZJPgoczwRPaD6Wej3B1U8JGbqvPqiN58IzyMA2cKA0DSH0XDGIamH MwKo5rTehMmLurdsZBO3r8VHFNJCQAtVycL96neJp6TvUnHkd2UUSnivFc79/t4ljYWB xXpA== X-Gm-Message-State: APjAAAWNVJXn2OzjcJV7kydtTwliGjZmUJsZ8/doB0ivUVk84AoDo5hg jIfiqnMEgfp2Dr7+r13bFI0= X-Received: by 2002:a17:90a:c20d:: with SMTP id e13mr701306pjt.95.1582258955584; Thu, 20 Feb 2020 20:22:35 -0800 (PST) Received: from sultan-book.localdomain ([104.200.129.62]) by smtp.gmail.com with ESMTPSA id w18sm812318pge.4.2020.02.20.20.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 20:22:34 -0800 (PST) Date: Thu, 20 Feb 2020 20:22:32 -0800 From: Sultan Alsawaf To: Mel Gorman Cc: Michal Hocko , Dave Hansen , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner Subject: Re: [PATCH] mm: Stop kswapd early when nothing's waiting for it to free pages Message-ID: <20200221042232.GA2197@sultan-book.localdomain> References: <20200219182522.1960-1-sultan@kerneltoast.com> <20200219194006.GA3075@sultan-book.localdomain> <20200219200527.GF11847@dhcp22.suse.cz> <20200219204220.GA3488@sultan-book.localdomain> <20200219214513.GL3420@suse.de> <20200219224231.GA5190@sultan-book.localdomain> <20200220101945.GN3420@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200220101945.GN3420@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 20, 2020 at 10:19:45AM +0000, Mel Gorman wrote: > I'm not entirely convinced. The reason the high watermark exists is to have > kswapd work long enough to make progress without a process having to direct > reclaim. The most straight-forward example would be a streaming reader of > a large file. It'll keep pushing the zone towards the low watermark and > kswapd has to keep ahead of the reader. If we cut kswapd off too quickly, > the min watermark is hit and stalls occur. While kswapd could stop at the > min watermark, it leaves a very short window for kswapd to make enough > progress before the min watermark is hit. > > At minimum, any change in this area would need to include the /proc/vmstats > on allocstat and pg*direct* to ensure that direct reclaim stalls are > not worse. > > I'm not a fan of the patch in question because kswapd can be woken between > the low and min watermark without stalling but we really do expect kswapd > to make progress and continue to make progress to avoid future stalls. The > changelog had no information on the before/after impact of the patch and > this is an area where intuition can disagree with real behaviour. > > -- > Mel Gorman > SUSE Labs Okay, then let's test real behavior. I fired up my i5-8265U laptop with vanilla linux-next and passed mem=2G on the command line. After boot up, I opened up chromium and played a video on YouTube. Immediately after the video started, my laptop completely froze for a few seconds; then, a few seconds later, my cursor began to respond again, but moving it around was very laggy. The audio from the video playing was choppy during this time. About 15-20 seconds after I had started the YouTube video, my system finally stopped lagging. Then I tried again with my patch applied (albeit a correct version that doesn't use the refcount API). Upon starting the same YouTube video in chromium, my laptop didn't freeze or stutter at all. The cursor was responsive and there was no stuttering, or choppy audio. I tested this multiple times with reproducible results each time. I will attach a functional v2 of the patch that I used. Sultan