Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1447701ybl; Fri, 23 Aug 2019 20:42:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7jV5ciMJ9oGDL+IPFjBugP44wzUyr25PRl+s3vWDOdT6mSmeKIjJkt3OumA2RsjF29kxK X-Received: by 2002:aa7:8c4c:: with SMTP id e12mr8942015pfd.258.1566618168815; Fri, 23 Aug 2019 20:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566618168; cv=none; d=google.com; s=arc-20160816; b=xHEAgE9uS8l2JPUVXiF/3cFVJ/maCq+OJ68esOh52fjtmPfhdXUtfH4Od2z2nlkD9+ oDYMcZXdsPoTFdDtj7zQHvAEjfgmGDPD1YMO7Fr+tx/TMWbicENUadtOjtPHqgW95dua vLucLsQJbEzyvLU2jyEPWkEsA4qlCFgCrhsrM2/q2RZq8ynDRFFLH4E4egFDpUR5mosM R3aS9YBkSmXjpmTTvqGfC0k99/jMy5nM6Ufed9D2MyDwwJGtjYa9ho6bAxv19tafe87M oZrrZf5bptGmxBbZDrRZ0BWbirtugtmF/2/6l+dtK900MN0wY9Qnsf4Swxq2tejlWP2E iaUw== 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=k4JfOThgU1rKXkGTSmWuM/49rJOouhdAv0PQSZEcT8E=; b=AJxbDiU7qg1Q1v+Pag916ZDQ+RobqPFXkvBiIF6xbIVJFv0/+zMoJqdfx9+QcwK86j 42sCOYo2xsDnyWZGb45xwxogvq8Ozw0Cs3CDF9Dr1ILI1XM1kHp8HLAqcGXphRQbSe1e d7VVoIAvsMq9b3FV6GalVxhE4ZK3Yw+yTO1EmJ8++UlkIXmImuVBNd845O0os/E0/LmI MO9PCpb3siDEOQFTFCdg5xd+LR09RO5GTwaQTZRstWUtxkmUJqg60nqj2T4iS07orRwG UZG7v6DzqPW/6qD8IJHVz+gGksbtUyvLBA41x4By+5L0xFuRFK94tLVksPf28Hc55g+Y ry4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XK+VZ1iV; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m127si3397698pgm.100.2019.08.23.20.42.33; Fri, 23 Aug 2019 20:42:48 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=XK+VZ1iV; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726793AbfHXDlq (ORCPT + 99 others); Fri, 23 Aug 2019 23:41:46 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:34325 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726397AbfHXDlq (ORCPT ); Fri, 23 Aug 2019 23:41:46 -0400 Received: by mail-io1-f68.google.com with SMTP id s21so24802662ioa.1 for ; Fri, 23 Aug 2019 20:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k4JfOThgU1rKXkGTSmWuM/49rJOouhdAv0PQSZEcT8E=; b=XK+VZ1iVfxgnbKguT+7cU89msBjcvPUQ3ycYVzyoHOjcWABcHh8bY1onqf4xYWwx0r 6zFiSXdqLXPrtwGw+qyxd7/HVupwGaZ3QCNqlrLdHFobNC1oSjNct0Vq0YQ2FuwfwkTA OaARrvajKojascXHNlOxZdSNs1FQXn33nqLl3B8f6l3P7r7ELaUHqOHaTsAKGMqNObeP tUMZy7BxTzau8ZMwO3u/Uncbg0GB+NUfaA6rzquorHGKAeIQQKH7zlnGgZ62EuukCXpY gKFGlTGUcWsb/Ej/QBGQo7ShqalwblzlRVouLU/DYxBrAfnG5cHFOwHVGhMvWlieWRIi AOPA== 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=k4JfOThgU1rKXkGTSmWuM/49rJOouhdAv0PQSZEcT8E=; b=dv3DjFAVMd1Vk1FSEUzlG4bfFhFdLqaUYO/qFSKboxht8teUYG9/swQz28m01P/UjV 7/0r1JCK4ot0czaab/lo00bnQ4mnE+kz3W9ZU/l7oZNtJf3St3kCXadOkzPrfbJT5+gW QtZC7qXnHbfaTnC2awyIfWTVa6N7E+xLWtcUpyRaLNjp6edpu56uYCPllW+yOkc///wx gPmTVaoKjar6AgB9/o6TnWhSerUTa04OIYJVW97MyLprONEeS27QBkZ5G61pF9x3LGBd WSjiOKw/Zwq858a6ZJovwjI9hx8v2dbE+tZIZxePvzV9vZO1krcEQ3yqXZ0OEjnJT6o7 jrww== X-Gm-Message-State: APjAAAUnBD1O6sel4S7CkMiS54Y70Azg+XsLlCUCDpnWMMh0lvTwCZsN ym+tr9O+6uQZTC/QcXx1Bm0c5Zh0HmJ8wceyKw8= X-Received: by 2002:a5d:934c:: with SMTP id i12mr4089843ioo.203.1566618105736; Fri, 23 Aug 2019 20:41:45 -0700 (PDT) MIME-Version: 1.0 References: <20190817004726.2530670-1-guro@fb.com> <20190823223257.GA22200@tower.DHCP.thefacebook.com> In-Reply-To: <20190823223257.GA22200@tower.DHCP.thefacebook.com> From: Yafang Shao Date: Sat, 24 Aug 2019 11:41:09 +0800 Message-ID: Subject: Re: [PATCH] Partially revert "mm/memcontrol.c: keep local VM counters in sync with the hierarchical ones" To: Roman Gushchin Cc: Andrew Morton , "linux-mm@kvack.org" , Michal Hocko , Johannes Weiner , "linux-kernel@vger.kernel.org" , Kernel Team 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 Sat, Aug 24, 2019 at 6:33 AM Roman Gushchin wrote: > > On Fri, Aug 16, 2019 at 05:47:26PM -0700, Roman Gushchin wrote: > > Commit 766a4c19d880 ("mm/memcontrol.c: keep local VM counters in sync > > with the hierarchical ones") effectively decreased the precision of > > per-memcg vmstats_local and per-memcg-per-node lruvec percpu counters. > > > > That's good for displaying in memory.stat, but brings a serious regression > > into the reclaim process. > > > > One issue I've discovered and debugged is the following: > > lruvec_lru_size() can return 0 instead of the actual number of pages > > in the lru list, preventing the kernel to reclaim last remaining > > pages. Result is yet another dying memory cgroups flooding. > > The opposite is also happening: scanning an empty lru list > > is the waste of cpu time. > > > > Also, inactive_list_is_low() can return incorrect values, preventing > > the active lru from being scanned and freed. It can fail both because > > the size of active and inactive lists are inaccurate, and because > > the number of workingset refaults isn't precise. In other words, > > the result is pretty random. > > > > I'm not sure, if using the approximate number of slab pages in > > count_shadow_number() is acceptable, but issues described above > > are enough to partially revert the patch. > > > > Let's keep per-memcg vmstat_local batched (they are only used for > > displaying stats to the userspace), but keep lruvec stats precise. > > This change fixes the dead memcg flooding on my setup. > > > > Fixes: 766a4c19d880 ("mm/memcontrol.c: keep local VM counters in sync with the hierarchical ones") > > Signed-off-by: Roman Gushchin > > Cc: Yafang Shao > > Cc: Johannes Weiner > > Any other concerns/comments here? > > I'd prefer to fix the regression: we're likely leaking several pages > of memory for each created and destroyed memory cgroup. Plus > all internal structures, which are measured in hundreds of kb. > Hi Roman, As it really introduces issues, I agree with you that we should fix it first. So for your fix, Acked-by: Yafang Shao Thanks Yafang