Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp70878ybf; Wed, 26 Feb 2020 09:01:43 -0800 (PST) X-Google-Smtp-Source: APXvYqwk5RW7Enfcy5FGEXq2BBJ773vwjhBrFEzsUrHVsfIKGusZzyQU/Apjq294KGOd+9H+rAGy X-Received: by 2002:a9d:5d0:: with SMTP id 74mr195050otd.256.1582736503042; Wed, 26 Feb 2020 09:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582736503; cv=none; d=google.com; s=arc-20160816; b=msdktZRJpJQ9nYkuFutXffetgFv2pfqh3k45V/Bmkfl3BHc9cRkRs3E+HyPqu2rGGm 9ZVRyiaj5WSfsjlNpOVa15Kx9foETPvNSg3coUSJ3hIAKW5+E5EY1umUGLcentkZ9psO 8Q9Z5lgBXez9QTYsw/ffJDErZo3Z0hkJQUiAVjfeJXPcFVx9Rgd7QrXEv6M/xiKAfjkE giYGyDuRbUNNgIDS1H9IdEnpRbeSQTUhaC9HSQJGnaEs7eRdZSj0MZEWE03ZwWZKifl4 ebZg0+dT2MeKaeUkUZi4aJ3ejK399vj6ufS40nv4pdlSUL4D5tOmDbtiIQiEQ1SZjULz 6Zwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VW6ry/recRSjstAhgd9IHAJ1qGHrxOyE270eFkPmjt8=; b=OhHg1GFJF42FUwYyQxO332B+vixdfDp477aiqrbOIYfu7NlU2d4L3PSC6E73A0vYOi wJNuak5DYcnYpA3uyBUeRNyJkjp9SKGWuCG7zcaN5w7THyzTWobCqWKrZdaegLLajmwa URleRpc+mIGGYv4zvZX/gQ+rSeMxzDeIrcLme5RL9wySV1nN0I9jdg9XYSwRqEd7oR0K lM2/xbtwQle4oAF0tsAIuErjKRBdH24Mj/vqRe+oG8KcEqkM8bi87vrjMCCeof216jEf xK3YpbVzDdprzbD+P36ud8KIWBsmOB62eiKQ/+k05SzkNRS9rD22/Nba3DQljLqUxNJx g6bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TbYSTEbY; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si1459772oia.33.2020.02.26.09.01.28; Wed, 26 Feb 2020 09:01:43 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=TbYSTEbY; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728337AbgBZRBL (ORCPT + 99 others); Wed, 26 Feb 2020 12:01:11 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:43089 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727922AbgBZRBL (ORCPT ); Wed, 26 Feb 2020 12:01:11 -0500 Received: by mail-ot1-f65.google.com with SMTP id p8so50039oth.10 for ; Wed, 26 Feb 2020 09:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VW6ry/recRSjstAhgd9IHAJ1qGHrxOyE270eFkPmjt8=; b=TbYSTEbY9mx/BwJIJncwOFE8193J4bVFp3qh+YNX4sdKcBgDkwafsfcr8X7VOODEFc 9Q3yDkALDFXoJKC9xKw4SIla3ILAM2kV8T+MH+EI16bIq1jvfQGwh4cbeKvGdL1jb3CO wH65vfwFskDDttPYABVm2zrRdc0vQorfws3lKOJHBqNjyzzKs2D9j0kTrqV3+Z5fHwpu 88L4l7ozO7v/bI8I4y8QTlSG7LoMC20cvVt/wJN9HFEKnT3su7BSulkHHFcMR9PdeGe/ i0V6obuHVl9Rc+9vz3E/392JlxgkVhBp3L+HjHw9zkQUdZtRnO8V8jNqn/tFrM5VdMoF /MZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VW6ry/recRSjstAhgd9IHAJ1qGHrxOyE270eFkPmjt8=; b=fhArWRYcRNlyw4ZfD0lgobxIdSrvlRfgsorE7LxySxOrwh87GdFJRRQJCHBucd0ArY xvfcALS8JTXelitIaOzHH0eFEMB8jlTVqRPkNH+1Nfjwd6lromluT1GmmMvydwXZOZZt ayYJGQLckd8m3RAu3BhPu/WP1jOW1FGq9XV5aNmL2uUrytohFeoEp5Bpn4g5uez8ENbu SD1dU7vHUeS53WQEK6IfoeIRwiUSyhi/9KXkshVIcMhbMzNuvGFy/XDaKkci5Q8NSl3X uaeO0J5GpyUz4bf25tyGFVu9W+WXPFUU+FG1+18eg4gj8jJ2ei6DDEK/X+GyQ1X6LNgd cq2Q== X-Gm-Message-State: APjAAAWTkC8qUhtVVK3YMoVo/xWmUD2b7BqC2jJj4ap40zqADVslBoaA 93l81M0C3r4IFRlYPyhB8mhiaNVyCC+KfeRLOJ+0KUiBac8= X-Received: by 2002:a05:6830:1305:: with SMTP id p5mr3658219otq.124.1582736469964; Wed, 26 Feb 2020 09:01:09 -0800 (PST) MIME-Version: 1.0 References: <20200219200527.GF11847@dhcp22.suse.cz> <20200219204220.GA3488@sultan-book.localdomain> <20200219214513.GL3420@suse.de> <20200219224231.GA5190@sultan-book.localdomain> <20200220101945.GN3420@suse.de> <20200221042232.GA2197@sultan-book.localdomain> <20200221080737.GK20509@dhcp22.suse.cz> <20200221210824.GA3605@sultan-book.localdomain> <20200225090945.GJ22443@dhcp22.suse.cz> <20200226090853.GC3771@dhcp22.suse.cz> In-Reply-To: <20200226090853.GC3771@dhcp22.suse.cz> From: Shakeel Butt Date: Wed, 26 Feb 2020 09:00:57 -0800 Message-ID: Subject: Re: [PATCH] mm: Stop kswapd early when nothing's waiting for it to free pages To: Michal Hocko Cc: Sultan Alsawaf , Mel Gorman , Dave Hansen , Andrew Morton , Linux MM , LKML , Johannes Weiner Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 26, 2020 at 1:08 AM Michal Hocko wrote: > > On Tue 25-02-20 14:30:03, Shakeel Butt wrote: > > On Tue, Feb 25, 2020 at 1:10 AM Michal Hocko wrote: > > > > > [snip] > > > > > > The proper fix should, however, check the amount of reclaimable pages > > > and back off if they cannot meet the target IMO. We cannot rely on the > > > general reclaimability here because that could really be thrashing. > > > > > > > "check the amount of reclaimable pages" vs "cannot rely on the general > > reclaimability"? Can you clarify? > > kswapd targets the high watermark and if your reclaimable memory (aka > zone_reclaimable_pages) is lower than the high wmark then it cannot > simply satisfy that target, right? Keeping reclaim in that situations > seems counter productive to me because you keep evicting pages that > might be reused without any feedback mechanism on the actual usage. > Please see my other reply. > I understand and agree with the argument that if reclaimable pages are less than high wmark then no need to reclaim. Regarding not depending on general reclaimability, I thought you meant that even if reclaimable pages are over high wmark, we might not want to continue the reclaim to not cause thrashing. Is that right? > > BTW we are seeing a similar situation in our production environment. > > We have swappiness=0, no swap from kswapd (because we don't swapout on > > pressure, only on cold age) and too few file pages, the kswapd goes > > crazy on shrink_slab and spends 100% cpu on it. > > I am not sure this is the same problem. It seems that the slab shrinkers > are not really a bottle neck here. I would recommend you to identify > which shrinkers are eating the cpu time in your case. > The perf profile shows that the kswapd is spending almost all its time in list_lru_count_one and memcg tree traversal. So, it's not just one shrinker. Yes, it's not exactly the same problem but I would say it is similar. For Sultan's issue, even if there are many reclaimable pages, we don't want to thrash. In this issue, thrashing is not happening but kswapd is going nuts on slab shrinkers. Shakeel