Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1645490ybt; Thu, 2 Jul 2020 10:13:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzClmtmWSwiKLC4Eq3vDSNFpYoVM8W3e6ILs6U5cnOS1OEmNqXM9uFrLN79frz7NHxDsHGC X-Received: by 2002:aa7:c816:: with SMTP id a22mr18872717edt.28.1593710007275; Thu, 02 Jul 2020 10:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593710007; cv=none; d=google.com; s=arc-20160816; b=tKtjaGXAov1EdY7FSpgvh7QJlpW1RkvyYqVFWvq0hyXxZ/eELi9m8cgTaQsZ4W0X7u 2recE3GpM9h9ooHcZ5y8nDEyNMLBHNxNacOV4FEGu21AUovdz4jx00hfEmrUAiVCwKYE QAulMHIUOaY4pNnslmLum+6nhGIt/bx0P7p6/usU6X+lLboJBQ0qVsYwlRT1yLusanCt eOFlaps9hzFNkh3Kd+LcJacSYbLzJrLLzL6Do04yG82rEO+GN21aWU7bYWWjc8jkodDq lto42y6U7j1c49Faddgkkk/DD49ypOvwv8BOkMyqy6oc6QrNpQhOX62uByWaVQ+UuGnZ 2RDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=UQMqU/oqcviJOT6ra19wu8jEYcT3DRqeElrxLzrejiE=; b=POqQN6Ye1I1kHQ8lYcvqnb2wamqjaU9Sv0y/5lHk4SuAaQArK/FSTJyzhz26vw4QsV AlJGaMLeiBDj+eXNd1lyqRNTnYUX2RCWUTxGgaYMTccgX5mEkFq8hwCxv+LCAAei7Kel 29t+8uXs6GbvN2WXQGndpZ5u1c/9mcdJ94Q4mXfyja2GPmvo+lBCa741DNApBVBt3GTT 01w1ylixGkJv83dZIDGGO9gMXABvDUEpE77fyZi+Bq682oyc9ZlvUbsfzacdFcY1ESOC obLEA4oHpFC2syFStGcujRr7Qs/K79k7gLKOt8LNAcwBS7M13xk4T2K/w4aJVzhRzjeh 7WQQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si6474119edp.98.2020.07.02.10.13.04; Thu, 02 Jul 2020 10:13:27 -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; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727005AbgGBRKP (ORCPT + 99 others); Thu, 2 Jul 2020 13:10:15 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40620 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726726AbgGBRKP (ORCPT ); Thu, 2 Jul 2020 13:10:15 -0400 Received: by mail-ed1-f67.google.com with SMTP id b15so24759869edy.7 for ; Thu, 02 Jul 2020 10:10:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UQMqU/oqcviJOT6ra19wu8jEYcT3DRqeElrxLzrejiE=; b=tEVSxNf7lqz43gjsG+VzL/bEnSOgLvsmpBAsrOS4qnA9k9ih3uR3NlEQuzhQfG0pVG mIm+HRIRsL7zODtLFlIGuJcUKE8hCTe/FhvM3rMeLTu7dUs+dRIZrlXIKXExldQvj3U9 vOm5Rrp1j/Z2GilHAvkQHStBDFevHDj4zmxDLrnV5zNSXtNexQT/WMYp7b67MqWTDzf8 IeTVcA7JXl+YoGnEd70tSLN7Eys/py3m0LiNgvhcLm9uythcPmgtVsNUVUHC3LVNyTTG SCvXxZOmlE1uE/3vPK9NsHBAn2iF/iImMswmY/frTml3lIPV8t2u+LrwH6BHsECEIF0I ZqvQ== X-Gm-Message-State: AOAM5315JB/mDUnb3oQrMeSZfo1qBsSxDnZAwqAbUTgbGIkeiDn7m+RH CE3GbBl2w/ZsAxBbToA/MRaiPEkB X-Received: by 2002:a05:6402:337:: with SMTP id q23mr36693172edw.63.1593709813149; Thu, 02 Jul 2020 10:10:13 -0700 (PDT) Received: from localhost (ip-37-188-168-3.eurotel.cz. [37.188.168.3]) by smtp.gmail.com with ESMTPSA id bw7sm7410420ejb.5.2020.07.02.10.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 10:10:12 -0700 (PDT) Date: Thu, 2 Jul 2020 19:10:11 +0200 From: Michal Hocko To: Vlastimil Babka Cc: Roman Gushchin , Naresh Kamboju , Shakeel Butt , Johannes Weiner , Andrew Morton , linux-mm , open list , lkft-triage@lists.linaro.org, Chris Down , Peter Zijlstra Subject: Re: BUG: Bad page state in process - page dumped because: page still charged to cgroup Message-ID: <20200702171011.GJ18446@dhcp22.suse.cz> References: <20200701082904.GM2369@dhcp22.suse.cz> <20200701184552.GA61684@carbon.DHCP.thefacebook.com> <20200702162202.GI18446@dhcp22.suse.cz> <57270a15-a792-5175-757b-c4bde6da3694@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57270a15-a792-5175-757b-c4bde6da3694@suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 02-07-20 18:35:31, Vlastimil Babka wrote: > On 7/2/20 6:22 PM, Michal Hocko wrote: > > On Wed 01-07-20 11:45:52, Roman Gushchin wrote: > > [...] > >> >From c97afecd32c0db5e024be9ba72f43d22974f5bcd Mon Sep 17 00:00:00 2001 > >> From: Roman Gushchin > >> Date: Wed, 1 Jul 2020 11:05:32 -0700 > >> Subject: [PATCH] mm: kmem: make memcg_kmem_enabled() irreversible > >> > >> Historically the kernel memory accounting was an opt-in feature, which > >> could be enabled for individual cgroups. But now it's not true, and > >> it's on by default both on cgroup v1 and cgroup v2. And as long as a > >> user has at least one non-root memory cgroup, the kernel memory > >> accounting is on. So in most setups it's either always on (if memory > >> cgroups are in use and kmem accounting is not disabled), either always > >> off (otherwise). > >> > >> memcg_kmem_enabled() is used in many places to guard the kernel memory > >> accounting code. If memcg_kmem_enabled() can reverse from returning > >> true to returning false (as now), we can't rely on it on release paths > >> and have to check if it was on before. > >> > >> If we'll make memcg_kmem_enabled() irreversible (always returning true > >> after returning it for the first time), it'll make the general logic > >> more simple and robust. It also will allow to guard some checks which > >> otherwise would stay unguarded. > >> > >> Signed-off-by: Roman Gushchin > > Fixes: ? or let Andrew squash it to some patch of your series (it's in mmotm I > think)? I would rather make it its own patch because this is really subtle. -- Michal Hocko SUSE Labs