Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp74802ybf; Wed, 26 Feb 2020 09:05:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzwPk/ffAf/5SooxKi2dwynUqHohILqGIL2Yzo0gc/Una9eIJULGbHo3ijpT4bO16i4uKrH X-Received: by 2002:a9d:7a89:: with SMTP id l9mr3768800otn.228.1582736713369; Wed, 26 Feb 2020 09:05:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582736713; cv=none; d=google.com; s=arc-20160816; b=Lmnp/3laLCbjR8HLwgua+GMqilDioRwwJBHjhwtdnyVh3wCw9XoOt9ho6c6bbaYAIE +QgEfvbNsHQrsLr0T2zGSp3x8Ki+g1KTRu6WHlcm2L3R7ScOLvwVL3HWmC4jSH7XbkSL 8rKynRy35yl48og/oaDdpBp+4L8WXyJaCaCFXBXyYqZ+Zu0Wd73QTNJjrTyXVv/Rd5tF S17zuXa1mN0FWBllSUeCd1yd21t5NCzH0wV7xVsPrJOETHDgUbjJaf6G6ib7Kr5tYtlD +pU3HWtq6BylbOvu+KvTT3PZItcxUkO8CziKA+IUmfJ1Ofwh/4mOql0U6acB8I439IKZ 9jAg== 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=uWGLFPb2JDmIkjCUPJN84txliHWIiSJvGLA5caQAIDY=; b=g8WmHUI1+oC8SouMAhSbhQVGL3XoOk45uH6VILdHeqEu4pOqAqAgLe5iRbGvcW7S7c uZsCgG2KEoRn9Lt3t5mixh07aRxZhzgsmJXlXrFNzfXuj+KOfEl+SxPrtlrhL5SM2Dvc ZpfaEp4dl2GYB4bdmJeZ8/HwA7YCFf5f9KSN9ZHso6GjeYsJ9N07bkFU9Jd14wLY+jWH O8/rKLWYaaDV74Qd7fhS5QZsalacn8NxmnhZ9c0l/VUxLajBVE3FjGYthec7TRSLGbjS vGGktkwx4H02VYU9zRfRCW3GzM/UBa3/Cvyb7hCZ1fDdDmz257tCCMTHh7yI/XmBmD+1 zs/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pRSRh7ZO; 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 o13si93489otp.27.2020.02.26.09.04.59; Wed, 26 Feb 2020 09:05:13 -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=pRSRh7ZO; 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 S1727265AbgBZREs (ORCPT + 99 others); Wed, 26 Feb 2020 12:04:48 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:37682 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726214AbgBZREs (ORCPT ); Wed, 26 Feb 2020 12:04:48 -0500 Received: by mail-ot1-f66.google.com with SMTP id b3so102563otp.4 for ; Wed, 26 Feb 2020 09:04:46 -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=uWGLFPb2JDmIkjCUPJN84txliHWIiSJvGLA5caQAIDY=; b=pRSRh7ZOElvt8MZ/XbjZd2EjwBs38ZohNIN09f86phdUa0OSrWstsvCpmIYkIhAyjE vGSLpfV8w33qWriFyNQjb+wdCrNN1nBfLj3OMK04kdIWa8EmPnvWxPQ8wfV4EfkHdFCR irTFAQFPGvgt1+iYzPRy4bGwoZKQ2IVxsrmV/EJmz4bq3aHIR8cm4EQxolr1/lE8XKtO ayKD+XugXPZxJT0SJj5oX4AeSWwMgIo/JkN3xGiNiDxe25sIo7XsxvGvXhWW8+nswFyn NmdE3PV2TBfU7wMqz3QAJ8Nq0fwrja/FPGPKSXo6ltR/1JgMB4qcYCCP60KaUwQWCJqN Zcog== 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=uWGLFPb2JDmIkjCUPJN84txliHWIiSJvGLA5caQAIDY=; b=hslpcj1jIIoni/28BUxY/lmUS2JNyCbhh1LaFvYk3Co7OUjFNIPyQHzK6DjmuBjglJ 9IgnoXhRZB09gfUbjo+ytrqt3MtWQXbH1rEmT2xLO/Pv370qbZLsAdIseDOS+DJrIwOF lMJ79rR61jFraOVY3OV7GvIhos3GaZvmh4SRMXddZICLv7JCw3zjiPiw+2um7B5mcHqe sNjwzQk0QCo/tnZIwoxqRPYx3up30jv1PZkxeBtfaC25/DzzkSyTZ/EhUHcqqKDh4Yh5 YRXaVbKmbLq0ME0No4ZGeHHaYaVlMhmyoFyOHct9ugNeKQw4Dbwl2gzrUhKGB/nc9xHC A6yg== X-Gm-Message-State: APjAAAVuvMljGeXcJ2flbW5QkOchr4ZwKyHNw9XwzOw7D3ThSzp7eHHy VTIIuSWzGaVx+MdOLb6PQE5ByH/1MnWBEOgf1CJpiA== X-Received: by 2002:a9d:6ac2:: with SMTP id m2mr3927552otq.191.1582736685661; Wed, 26 Feb 2020 09:04:45 -0800 (PST) MIME-Version: 1.0 References: <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> <20200221042232.GA2197@sultan-book.localdomain> <20200221080737.GK20509@dhcp22.suse.cz> <20200221210824.GA3605@sultan-book.localdomain> <20200225090945.GJ22443@dhcp22.suse.cz> <20200226105137.9088-1-hdanton@sina.com> In-Reply-To: <20200226105137.9088-1-hdanton@sina.com> From: Shakeel Butt Date: Wed, 26 Feb 2020 09:04:34 -0800 Message-ID: Subject: Re: [PATCH] mm: Stop kswapd early when nothing's waiting for it to free pages To: Hillf Danton Cc: Sultan Alsawaf , Mel Gorman , Dave Hansen , Andrew Morton , Linux MM , LKML 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 4:15 AM Hillf Danton wrote: > > > On Tue, 25 Feb 2020 14:30:03 -0800 Shakeel Butt wrote: > > > > 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. > > Dunno if swappiness is able to put peace on your kswapd. > > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2631,8 +2631,14 @@ static inline bool should_continue_recla > */ > pages_for_compaction = compact_gap(sc->order); > inactive_lru_pages = node_page_state(pgdat, NR_INACTIVE_FILE); > - if (get_nr_swap_pages() > 0) > - inactive_lru_pages += node_page_state(pgdat, NR_INACTIVE_ANON); > + do { > + struct lruvec *lruvec = mem_cgroup_lruvec(sc->target_mem_cgroup, pgdat); > + struct mem_cgroup *memcg = lruvec_memcg(lruvec); > + int swappiness = mem_cgroup_swappiness(memcg); > + > + if (swappiness && get_nr_swap_pages() > 0) Thanks for finding this. I think we also need to check sc->may_swap as well. Can you please send a signed-off patch? It may or maynot help kswapd but I think this is needed. > + inactive_lru_pages += node_page_state(pgdat, NR_INACTIVE_ANON); > + } while (0); > > return inactive_lru_pages > pages_for_compaction; > } >