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=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham 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 5C4ACC282CE for ; Wed, 24 Apr 2019 16:50:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E7CD218FE for ; Wed, 24 Apr 2019 16:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556124614; bh=m09O6isvdICQlDEPiegTbMTq7rjR1S3XQvhMRhgWkkk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=tIOeTWqx0O7hxhn8Q8nIh/lEW6OSP9CKGG7/oSHEtoPc0WvnHygdVyIpnaW261QX3 rV5WJMhNup028O2Y0gXvvTiLWy3p9XJx4FlC4X3ZXqkaBdCQ2Qg0tINiidvDbQzXhx hCc1ajDsIqSwniqCv2dWyxH9operP3/waOkt7+to= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727769AbfDXQuN (ORCPT ); Wed, 24 Apr 2019 12:50:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:56572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732828AbfDXQuM (ORCPT ); Wed, 24 Apr 2019 12:50:12 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (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 6BAED206A3; Wed, 24 Apr 2019 16:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556124611; bh=m09O6isvdICQlDEPiegTbMTq7rjR1S3XQvhMRhgWkkk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EdzHmpVHZiml1kMCxdo1jwv6WMSAc7fqIks0VHRVAAnCcVQlSGm8y0cQYA9yiSYOy j7ttr05ktxtBANy1oRtbT2xIa0BXRRvcUaqabhc+/BbibZw034EqcByT4/sLmeWbhb z1ltZ6BluC52EdeRMozT4bOLWCoJ6ZF8SOVF22EY= Date: Wed, 24 Apr 2019 18:50:09 +0200 From: Greg KH To: Vaibhav Rustagi Cc: stable@vger.kernel.org, hannes@cmpxchg.org, tj@kernel.org, mhocko@suse.com, vdavydov.dev@gmail.com, guro@fb.com, riel@surriel.com, sfr@canb.auug.org.au, akpm@linux-foundation.org, torvalds@linux-foundation.org Subject: Re: [For Stable] mm: memcontrol: fix excessive complexity in memory.stat reporting Message-ID: <20190424165009.GE21916@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Apr 01, 2019 at 10:35:59PM -0700, Vaibhav Rustagi wrote: > In linux stable kernel (tested on 4.14), reading memory.stat in case > of tens of thousands of ghost cgroups pinned by lingering page cache > takes up to 100 ms ~ 700 ms to complete the reading. Great, don't do that :) > Repro steps (tested on 4.14 kernel): > > $ cat /tmp/make_zombies > > mkdir /tmp/fs > mount -t tmpfs nodev /tmp/fs > for i in {1..10000}; do > mkdir /sys/fs/cgroup/memory/z$i > (echo $BASHPID >> /sys/fs/cgroup/memory/z$i/cgroup.procs && echo $i > > /tmp/fs/$i) > done > > # establish baseline > $ perf stat -r3 cat /sys/fs/cgroup/memory/memory.stat > /dev/null > 0.011642670 seconds time elapsed > > $ bash /tmp/make_zombies > $ perf stat -r3 cat /sys/fs/cgroup/memory/memory.stat > /dev/null > 0.134939281 seconds time elapsed > > $ rmdir /sys/fs/cgroup/memory/z* > $ perf stat -r3 cat /sys/fs/cgroup/memory/memory.stat > /dev/null > 0.135323145 seconds time elapsed > # even after rmdir we have zombies, so still slow. > > The fix is already present in linux master (since 4.16) by following commits: > > c9019e9bf42e66d028d70d2da6206cad4dd9250d mm: memcontrol: eliminate raw > access to stat and event counters > 284542656e22c43fdada8c8cc0ca9ede8453eed7 mm: memcontrol: implement > lruvec stat functions on top of each other > a983b5ebee57209c99f68c8327072f25e0e6e3da mm: memcontrol: fix > excessive complexity in memory.stat reporting > c3cc39118c3610eb6ab4711bc624af7fc48a35fe mm: memcontrol: fix > NR_WRITEBACK leak in memcg and system stats > e27be240df53f1a20c659168e722b5d9f16cc7f4 mm: memcg: make sure > memory.events is uptodate when waking pollers > > I would like to request cherry-picking the above commits to > linux-stable branch - 4.14. What's wrong with just moving to a newer kernel, like 4.19.y, if you have this issue? That's a much better thing to do than to backport the above patches, right? As this is just an "annoyance", on the old kernel, I don't really see why it's needed to be backported, it can't cause any problems overall, right? thanks, greg k-h