Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1716447

Re: kernel panic on null pointer on page->mem_cgroup

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: kernel panic on null pointer on page->mem_cgroup
Date Mon, 21 Aug 2017 15:30:02 +0200
Message-ID <ugUWe-4Ub-17@gated-at.bofh.it> (permalink)
References <ucfyj-2uV-43@gated-at.bofh.it> <ucg1k-2Fc-19@gated-at.bofh.it> <ucgE1-3bf-9@gated-at.bofh.it> <ucicN-4h6-3@gated-at.bofh.it> <uciZc-5aW-23@gated-at.bofh.it> <ucoie-8qy-17@gated-at.bofh.it> <ucp4B-Fu-1@gated-at.bofh.it> <ucE3F-2ye-41@gated-at.bofh.it> <ucUi6-55n-23@gated-at.bofh.it> <ugUCR-4Nm-3@gated-at.bofh.it>
X-Original-To Johannes Weiner <hannes@cmpxchg.org>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 32
Organization linux.* mail to news gateway
X-Original-Cc Brad Bolen <bradleybolen@gmail.com>, Jaegeuk Kim <jaegeuk@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Vladimir Davydov <vdavydov.dev@gmail.com>, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Mon, 21 Aug 2017 15:23:45 +0200
X-Original-Message-ID <20170821132345.GK25956@dhcp22.suse.cz>
X-Original-References <20170808162122.GA14689@cmpxchg.org> <20170808165601.GA7693@jaegeuk-macbookpro.roam.corp.google.com> <20170808173704.GA22887@cmpxchg.org> <CADvgSZSn1v-tTpa07ebqr19heQbkzbavdPM_nbRNR1WF-EBnFw@mail.gmail.com> <20170808200849.GA1104@cmpxchg.org> <20170809014459.GB7693@jaegeuk-macbookpro.roam.corp.google.com> <CADvgSZSNn7N3R7+jjeCgns2ZEPtYc6c3MWmkkQ3PA+0LHO_MfA@mail.gmail.com> <20170809183825.GA26387@cmpxchg.org> <20170810115605.GQ23863@dhcp22.suse.cz> <20170821130218.GA1371@cmpxchg.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1716447

Show key headers only | View raw


On Mon 21-08-17 09:02:18, Johannes Weiner wrote:
> On Thu, Aug 10, 2017 at 01:56:05PM +0200, Michal Hocko wrote:
> > On Wed 09-08-17 14:38:25, Johannes Weiner wrote:
> > > The issue is that writeback doesn't hold a page reference and the page
> > > might get freed after PG_writeback is cleared (and the mapping is
> > > unlocked) in test_clear_page_writeback(). The stat functions looking
> > > up the page's node or zone are safe, as those attributes are static
> > > across allocation and free cycles. But page->mem_cgroup is not, and it
> > > will get cleared if we race with truncation or migration.
> > 
> > Is there anything that prevents us from holding a reference on a page
> > under writeback?
> 
> Hm, I'm hesitant to add redundant life-time management to the page
> there just for memcg, which is not always configured in.
> 
> Pinning the memcg instead is slightly more complex, but IMO has the
> complexity in a preferrable place.

If that is the single place that needs such a special handling and it is
very likely to stay that way then the additional complexity is probably
justified. I am just worried that this is really subtle and history
tells us that such a code usually kicks us back later.
 
> Would you agree?

Well, I was not objecting to the patch. It seems correct I am just
worried a robust fix would be preferable. And a clear object life time
sounds like a more robust thing to do.
-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: kernel panic on null pointer on page->mem_cgroup Johannes Weiner <hannes@cmpxchg.org> - 2017-08-21 15:10 +0200
  Re: kernel panic on null pointer on page->mem_cgroup Michal Hocko <mhocko@kernel.org> - 2017-08-21 15:30 +0200

csiph-web