Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1036087pxk; Thu, 3 Sep 2020 21:12:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfmjSvQU3PPUme2ez+nimVuDR5ktjrzsUP5zXA0XYwvGorrEsBVET4k3xSbsaXvtIrZV5W X-Received: by 2002:a17:906:c1c3:: with SMTP id bw3mr5397836ejb.516.1599192740722; Thu, 03 Sep 2020 21:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599192740; cv=none; d=google.com; s=arc-20160816; b=vsDNOMECuPbpczJDi+txk1WhD8cgR2ZuqfY3B5s5KUjTVSJJKmR1TMdPQN9Kz9OB9n iQ5kWd7UaBXrZ0Ti9UWyHEfF13OdIedhkZnU48aee5SoaRkE0dqMr9VwRqjs5RFEsopT N9g8GBzm+d6oXGnc+Rh7LD4lVip/TpUYZDCnkeQO3SAQDnwfJvx2mTIwwARv/q/nxPxz O46JgWzkx966C+R7z3G8xu3px7XOEsyK24Zq0+CVUobdc64hz77GlVGBOfN2/VkR7AtH i5H/okn4+qHX+/ytvauoSoxkjQEqWiznhuemZtTQDcBcOcu+HfwHFI13tkjUhM53GfV2 lxUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=c0xafxGYoir/BHB5LJY+w258ljw37l+nPu84rb4iHY0=; b=vM+5g5aQlWm+TTUkwQYMY/IqlQxF7lE4wtGLNCq4MEkvzZT4X4JHJc9ZpXKdePujMd Av8kq9ux7thcNbM0ImNhZjTIcFIklNZ0+i/l/YavNHVZl72QBGNIPvp69w7gehcrxZDu i639JEmzpyICd4qhc9Vl9Ujf2kNB/XJVaRmfG1hISyjRF4pJu7JUXZg9XqBZ8VDcCfgv ybhDg6lQOOITwE6VU0wSq3IKFL60iEx/WzFVuAqp89yGPXJYIQX3vKr5jO2fOxB+F5BZ c+GklO4L1UeU8wmAHvGNPRCSBOP7QS78gTovMuBRzF6il6NU6oNUsF60Ii5iurAjqBKQ s8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LmRE7aS3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n24si3542878eji.99.2020.09.03.21.11.57; Thu, 03 Sep 2020 21:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LmRE7aS3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726089AbgIDELD (ORCPT + 99 others); Fri, 4 Sep 2020 00:11:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:36104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725765AbgIDELB (ORCPT ); Fri, 4 Sep 2020 00:11:01 -0400 Received: from X1 (nat-ab2241.sltdut.senawave.net [162.218.216.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 64FEB206CA; Fri, 4 Sep 2020 04:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599192660; bh=atSQ1o94B/mGNkpCk9TKMEzNNhHtnGV27b0zlomMdaw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LmRE7aS3pA2ZJRm7NWj+alJW+v+FXw2FQByZDOcuw08XdnOhI4cN0nOzbM0c9JiZT +R1D6h0SlX3FksGomoe2dNEWxWDSOvrgXJvZqzt+bdsiLX87x0WXfbwmdp7ypkj7+R inY6QqYpkDXkGm0pKb/Ojm5uhOMxxsirxRnvQ8x4= Date: Thu, 3 Sep 2020 21:10:59 -0700 From: Andrew Morton To: Roman Gushchin Cc: , =Shakeel Butt , Johannes Weiner , Michal Hocko , , , Michal Hocko Subject: Re: [PATCH] mm: workingset: ignore slab memory size when calculating shadows pressure Message-Id: <20200903211059.7dc9530e6d988eaeefe53cf7@linux-foundation.org> In-Reply-To: <20200903230055.1245058-1-guro@fb.com> References: <20200903230055.1245058-1-guro@fb.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Sep 2020 16:00:55 -0700 Roman Gushchin wrote: > In the memcg case count_shadow_nodes() sums the number of pages in lru > lists and the amount of slab memory (reclaimable and non-reclaimable) > as a baseline for the allowed number of shadow entries. > > It seems to be a good analogy for the !memcg case, where > node_present_pages() is used. However, it's not quite true, as there > two problems: > > 1) Due to slab reparenting introduced by commit fb2f2b0adb98 ("mm: > memcg/slab: reparent memcg kmem_caches on cgroup removal") local > per-lruvec slab counters might be inaccurate on non-leaf levels. > It's the only place where local slab counters are used. > > 2) Shadow nodes by themselves are backed by slabs. So there is a loop > dependency: the more shadow entries are there, the less pressure the > kernel applies to reclaim them. > > Fortunately, there is a simple way to solve both problems: slab > counters shouldn't be taken into the account by count_shadow_nodes(). > > ... > > --- a/mm/workingset.c > +++ b/mm/workingset.c > @@ -495,10 +495,6 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker, > for (pages = 0, i = 0; i < NR_LRU_LISTS; i++) > pages += lruvec_page_state_local(lruvec, > NR_LRU_BASE + i); > - pages += lruvec_page_state_local( > - lruvec, NR_SLAB_RECLAIMABLE_B) >> PAGE_SHIFT; > - pages += lruvec_page_state_local( > - lruvec, NR_SLAB_UNRECLAIMABLE_B) >> PAGE_SHIFT; > } else > #endif > pages = node_present_pages(sc->nid); Did this have any observable runtime effects?