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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99166C432BE for ; Mon, 9 Aug 2021 11:49:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1021B61004 for ; Mon, 9 Aug 2021 11:49:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1021B61004 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1F3BD6B006C; Mon, 9 Aug 2021 07:49:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 17CD96B0071; Mon, 9 Aug 2021 07:49:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 044528D0001; Mon, 9 Aug 2021 07:49:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id DAB386B006C for ; Mon, 9 Aug 2021 07:49:21 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8C2421808F800 for ; Mon, 9 Aug 2021 11:49:21 +0000 (UTC) X-FDA: 78455371722.06.0B63237 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf17.hostedemail.com (Postfix) with ESMTP id 13B3DF00039B for ; Mon, 9 Aug 2021 11:49:20 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id EE3361FDCB; Mon, 9 Aug 2021 11:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1628509759; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PTbs/oAWdsEgUa8fNGlTSzW9u7qIXvDedRy0yP7NhHs=; b=iKDi+/fu4Gd8GxCi3jrRjW3J0vrQwJwVllhFySyBgCyikeLsyuwZuzHer6hzEfVM3ERyRy h8GScA/lbnan9QBPXttTNxHehkaMYkYlE4QwL+LwebbBM33kTIHSZBBb6Gow8B6s0Hthsz 8mgsqHHmk/q5Eg6ksB8Y+o9+5q4tXqo= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id BEC5FA3B89; Mon, 9 Aug 2021 11:49:19 +0000 (UTC) Date: Mon, 9 Aug 2021 13:49:19 +0200 From: Michal Hocko To: Shakeel Butt Cc: Nico Pache , Linux MM , Andrew Morton , LKML , Johannes Weiner , Rafael Aquini , Waiman Long Subject: Re: [PATCH] vm_swappiness=0 should still try to avoid swapping anon memory Message-ID: References: <20210806231701.106980-1-npache@redhat.com> <91605888-e343-2712-c097-bcade4cb389d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="iKDi+/fu"; spf=pass (imf17.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 13B3DF00039B X-Stat-Signature: 1bez49d3u1toucpbdiwkarmrisaz37a6 X-HE-Tag: 1628509760-316580 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 Fri 06-08-21 22:23:48, Shakeel Butt wrote: > On Fri, Aug 6, 2021 at 6:37 PM Nico Pache wrote: > > > > > > On 8/6/21 9:00 PM, Shakeel Butt wrote: > [...] > > > If you are really seeing the said behavior then why will this fix it. > > > This is just about deactivating active anon LRU. I would rather look > > > at get_scan_count() to check why swappiness = 0 is still letting the > > > kernel to scan anon LRU. BTW in cgroup v1, the memcg can overwrite > > > their swappiness which will be preferred over system vm_swappiness. > > > Did you set system level swappiness or memcg one? > > > > This fixes the issue because shrink_list() uses the may_deactivate field > > to determine if it should shrink the active list. > > First, the shrink_list() will not be called for anon LRU if get_scan_count() > has decided to not scan the anon LRU. > > Second, I would like to get your attention to the following comment in > get_scan_count(): > > "Global reclaim will swap to prevent OOM even with no swappiness" > > It seems like the behavior you are seeing is actually working as intended. > You may decide to change that behavior but you will need to motivate the > change. Yes this is true. Only the memcg has a strict no swapping behavior historically. I do agree that the patch should go into much more details about the existing problem though. In this context it would be really good to explain why trashing over page cache is a better outcome than swapping out some pages. -- Michal Hocko SUSE Labs