Received: by 10.223.176.5 with SMTP id f5csp877248wra; Wed, 7 Feb 2018 08:57:36 -0800 (PST) X-Google-Smtp-Source: AH8x227VeAMXQx1Iyx4U8mWpAyt5uglvCxpM7dDJXhXYlM3Gr7eEFLtZmCeqHdPwShEvLCutmGuf X-Received: by 10.101.80.204 with SMTP id s12mr5453930pgp.185.1518022656492; Wed, 07 Feb 2018 08:57:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518022656; cv=none; d=google.com; s=arc-20160816; b=KQF+uqjCqWg4qLebm8MHUYIVZQP7TBSdcyXiKxt2Fc9Tg/0wtGUiOgcLne4h0xUN1d lSanjGPwwIg6We1mtd4Zx+RkA4raEhDzpWHC0fGK4sEgpkyAIK0AkrxMn5JGEkORk7aH KSgaA7Es2WJaqLH4nquP62otlXW5t2+HOTvHD+blHei+nEZExKMp6fF3YLD8fVjoVPQ/ cBatMMPnxkd6mzMGXgj4nmphAUIVE4Re9DwKIpak4pjvQ/MdNtjBt4NL25CkUjt5bVCx a0LlFHnQpSt7VnxF9wQCBgTSg8cfvWle3V/i+psnNgn1KqRc9M8qgKrWTue7PW6HLUh2 VE/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Bj4+YG1h0XbAXmRQg4EvAJuHGH96NtJRGKXXiXTFbJ0=; b=RDr1MJ1ZrumA1TSN9qOGtHyOQFSIJ8M92zRvou//J4QsvbEE2GaDeFjrFEFeHTx2e4 +x+5tzfbBYASpyQ4Si/HMD+U4xzZfam3koJY9AAwpW9iEE+q1DRnYsFNuhMNVfKWfcUe tWvj9lzXR+OhljO9OaXVZ/VvK2GBJEuLUlZjUaqBGf+V2njmKyRIrd7xuCnxcV/YRrzD UEipZM4DeYNkVeG0S1dDlHhYpnOSsuhrLk5fpKgmNxA874iH7Qkf0T0WbOFATPfNkIfY M1iWCM4K4Su8pazZ/1aUB2XQ5enTYIH3/zyxU2wCvRG6e0BJBcBaM2S9xR7qCHDavdeD XaFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=L75cdHM8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si1142052pgd.292.2018.02.07.08.57.22; Wed, 07 Feb 2018 08:57:36 -0800 (PST) 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=fail header.i=@cmpxchg.org header.s=x header.b=L75cdHM8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754752AbeBGQz6 (ORCPT + 99 others); Wed, 7 Feb 2018 11:55:58 -0500 Received: from gum.cmpxchg.org ([85.214.110.215]:46226 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754392AbeBGQz4 (ORCPT ); Wed, 7 Feb 2018 11:55:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Bj4+YG1h0XbAXmRQg4EvAJuHGH96NtJRGKXXiXTFbJ0=; b=L75cdHM8fqeUOjdlBAF+sVExv2 KknWEafW1rRrQC7A08l7FxMWs8WEG3BfKMP255p6oIN/sQekkRnsSPdRgYyiAoDxHt0OA4VV53ZdM x2us/lLty3GUKeczWBu1mKa17oBJaPax6AhDqutBrwAzSBm9Zh2fQ8ePbmkmzLUREh7E=; Date: Wed, 7 Feb 2018 11:55:47 -0500 From: Johannes Weiner To: Shakeel Butt Cc: Andrew Morton , Tejun Heo , Michal Hocko , Linux MM , Cgroups , LKML , kernel-team@fb.com Subject: Re: [PATCH] mm: memcontrol: fix NR_WRITEBACK leak in memcg and system stats Message-ID: <20180207165547.GB29418@cmpxchg.org> References: <20180203082353.17284-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shakeel, On Wed, Feb 07, 2018 at 07:44:08AM -0800, Shakeel Butt wrote: > On Sat, Feb 3, 2018 at 12:23 AM, Johannes Weiner wrote: > > After the ("a983b5ebee57 mm: memcontrol: fix excessive complexity in > > memory.stat reporting"), we observed slowly upward creeping > > NR_WRITEBACK counts over the course of several days, both the > > per-memcg stats as well as the system counter in e.g. /proc/meminfo. > > > > The conversion from full per-cpu stat counts to per-cpu cached atomic > > stat counts introduced an irq-unsafe RMW operation into the updates. > > > > Most stat updates come from process context, but one notable exception > > is the NR_WRITEBACK counter. While writebacks are issued from process > > context, they are retired from (soft)irq context. > > > > When writeback completions interrupt the RMW counter updates of new > > writebacks being issued, the decs from the completions are lost. > > > > Since the global updates are routed through the joint lruvec API, both > > the memcg counters as well as the system counters are affected. > > > > This patch makes the joint stat and event API irq safe. > > > > Fixes: a983b5ebee57 ("mm: memcontrol: fix excessive complexity in memory.stat reporting") > > Debugged-by: Tejun Heo > > Signed-off-by: Johannes Weiner > > Should this be considered for stable? The stable tree is only for fixes to already released kernels, but there is no release containing the faulty patch: $ git describe --tags a983b5ebee57 v4.15-3322-ga983b5ebee57 nor was the faulty patch itself marked for stable. So as long as this fix makes it into 4.16 we should be good.