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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 37ACCC43381 for ; Tue, 2 Apr 2019 05:24:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EEF352075E for ; Tue, 2 Apr 2019 05:24:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="tdiw86Z4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fsuLH3Mm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfDBFYt (ORCPT ); Tue, 2 Apr 2019 01:24:49 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:48259 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbfDBFYt (ORCPT ); Tue, 2 Apr 2019 01:24:49 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DCD1622257; Tue, 2 Apr 2019 01:24:47 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 02 Apr 2019 01:24:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=B89gG88Mr7zvvNuz1UZGEYBePj2 47zlMKC3Sn+JCRcw=; b=tdiw86Z4dzS6mR1kpf3Mef8riJvFLAyJ1/8c1McLdD+ tgrKJHpvx4mcA35oEXrrLZr+kZPWjc2JT21xYlTyeeA0muT8S+jFEEYxrvng5aDw ZIe42OxK1m29SLKMyp88UQpIQ8HU0OOkaZYNrZuiNV0ZyPUofzHOeU1WIVpKjdBP P4BLazNbmPNwKuIrZrVgDX24GbGRJ04lv0M8QCBoI1Z7N4U9JjAl9akNzob75V6/ LQG9rgctMHWHlq6dAB0c7OQcQAz8L0FCalTCitncvjqgRsHKUBCthdjlMddSyc1F socLeQevk8UvnlcB/yo3A61ZxtxC3rPj1Xg+1y0XMfA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=B89gG8 8Mr7zvvNuz1UZGEYBePj247zlMKC3Sn+JCRcw=; b=fsuLH3MmCrV8tWMnrrA8Qn o4M49riXAeYUbSZVjLl4lQhJPHcgy4kSQiaZwzkZNvNXV6J4xWKgz+d1Q4zDGlgU 8QTROyhI8i/JKCEyU/KlgfjhY+zFXZJjNPU9mBdnMVjSmDqILJgJtwlSjWV7A8Xj zUxFDaVWcS+nq1Vt3lGNcoWdhFBstm/dNMKGxHyOjEgC+SdvtAx1UGTzAh9lssD1 O3J52+1XbY8XY1qNQ7F5Ydl4LxodSPtrLz8jAfVanItK8qHTkjR4bs0GTVDf+EX/ 8Vx/auAjDo2ul5GSKPqNgb1Wg1B10yuvRYw3Ed55tl+jTwD+kiCz40FF4NBY86UA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrleehgdeklecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujggfsehttdertddtredvnecuhfhrohhmpefirhgvghcu mffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucfkphepkeefrdekiedrkeelrddutd ejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomhenucev lhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id A8F65100E5; Tue, 2 Apr 2019 01:24:44 -0400 (EDT) Date: Tue, 2 Apr 2019 07:24:39 +0200 From: Greg KH To: Vaibhav Rustagi Cc: stable@vger.kernel.org, hannes@cmpxchg.org Subject: Re: [For Stable] mm: memcontrol: fix excessive complexity in memory.stat reporting Message-ID: <20190402052439.GA12589@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 01:34:14PM -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. > > 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. Please resend and cc: all of the people on those patches so we can get their opinion on if this is stable kernel material or not. thanks, greg k-h