Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2124964pxa; Mon, 3 Aug 2020 08:06:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSebXmlyRfo/rALohnl+P1LvPpj/a3iV/pId2BNIr/YqHsQ3O1dkzPzOiOY3C8ES+MeSUi X-Received: by 2002:a17:907:372:: with SMTP id rs18mr16590830ejb.146.1596467177960; Mon, 03 Aug 2020 08:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596467177; cv=none; d=google.com; s=arc-20160816; b=glwJwS4vKfJ42nH5yrIcrFPtv/N2XY3uGLRHVuFAxsSFonkN7H3hCRKGKUV5fSqlNX lOVJrsKO4dulSF1w39i/XvPVTZsSAzwyYlyoq0RWUDbpjJs1RJYXSya6B2C8b/46a85U 0oBbT2y9LgI6An0i5rCj0YvH7Jm+4jodgUEHnOXR4gxvsFQLpw1VIN20z/nw5T8Niz/n Drgaq1vHRmaGJHk769rr3x/GvtkDjYjmMVNmOZ1DTar19CXRJxirkVRONjlf9Q+sDmMP P5Z9v1MSJmQdDjRwROyDvAVCvRMb28Az9tiC3P9wW0iI4t7UATZ110h0nOs/qJhc3MuL 8KAg== 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 :dkim-signature; bh=v+Y+IeNd3F1n7XlNjxMNDs/pWS3JUJFhlRHoN7oY4mY=; b=do+6KskdIJisEa3VPdq+tOrNmE+LESgCZ0EIAFznLKV6C5ishf2Aj9Hu1JfI4yq3z6 wRrt6iMWCPcOZQeF+0N2RaUbTcVocUEZqE1RQ0twIsbcg1vCleOMR74WPhlrEzmfLCR7 WjtQtAgbpmCM1JFotXhwmthB06OTlIh5lIxl+Ay9GWERpnFkBiQ4NACfVC1MZzKDvDLd SLrTIc5SQYP1ZLwSCHVlo85lrFZU8PlOK1eSGg8wG/0TzTpXzcp+Zh5Imlabin5oLKOr lMwvz4fuLFqEV8KoDP+ufd8hqa6MoyDH2MtSayiZIFnP4zbrA2RqrAVSfltjDNeCwRgT TB6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b="dPmwvzU/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z20si10569272ejb.359.2020.08.03.08.05.54; Mon, 03 Aug 2020 08:06:17 -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; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b="dPmwvzU/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727803AbgHCPE6 (ORCPT + 99 others); Mon, 3 Aug 2020 11:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbgHCPE5 (ORCPT ); Mon, 3 Aug 2020 11:04:57 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3742C06174A for ; Mon, 3 Aug 2020 08:04:57 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id e5so14387269qth.5 for ; Mon, 03 Aug 2020 08:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=v+Y+IeNd3F1n7XlNjxMNDs/pWS3JUJFhlRHoN7oY4mY=; b=dPmwvzU/T3ag5U9ZtHrb8FV/spAvxfqrf4OhrQC7VydMsrv1GHyUT0zQQAEW7C/Qtt Yt8Rem5DpO9L7QJV7wMT1FFmOTy8QBWr/wHw45xpFH//Qjd/lhzEfCSnHhIHGGPPohZT Qk1jGOLKPFn1VPCZDl0/bGw5fpyz0SRe48g6oY/c2Ig1GX4uSXppcfWs8N438ECQQ39y aGznKxCwvspawWMJN2u9PIB8uprF/BpoBJxjnTbkgUARj/1SI4YZvGhrcjqYl4aiIINW zslsvSi/tek2Dac92PSdQfoDsTHLPlLIk8YJpto6kYzAsXst393AATiGwLEve+0aEp/V fzuQ== 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=v+Y+IeNd3F1n7XlNjxMNDs/pWS3JUJFhlRHoN7oY4mY=; b=XDiFRSXq9Mo97r5FAwEROPUSwXjn8xbnmpbWx8OL06Dmt+IOOCwJchUSIknlnICFiK R+1Rgz0tGdcBjGzokCTPNGEU5x8wgeZg8Il5pFA9JDgm5JNLv7MFVG01UbR/ttBnyJ9B kleZUbaIeRUJ3kfNyxvqenOlI8izBS20P8wpckhffkd4NJkGC4r0QvxxZDx6nYipw8tl phquSn5dxQS/3ZW7dySkL6hBrIeDSqIG3xUyKfyy3/1YLRWpWWXfidMOx7wXw1EdK8UR gQH1JEVmJYCqClZ9N7KAPEYkF1U7E6hRyGLp64CCWX9p33WLfA1cwI/h06ZvujJQWQr4 4Dwg== X-Gm-Message-State: AOAM530r3TRQpjEzU7RmAzJ5MfQ77oNLDqJu1i302pHtHsO+SIY0QXhE CPD0ldqv67cHe9VU12TNP+pX8A== X-Received: by 2002:ac8:5146:: with SMTP id h6mr17130263qtn.290.1596467096898; Mon, 03 Aug 2020 08:04:56 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:ce31]) by smtp.gmail.com with ESMTPSA id s33sm23316565qtk.11.2020.08.03.08.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 08:04:53 -0700 (PDT) Date: Mon, 3 Aug 2020 11:03:49 -0400 From: Johannes Weiner To: Michal Hocko Cc: Roman Gushchin , Andrew Morton , Christoph Lameter , Shakeel Butt , linux-mm@kvack.org, Vlastimil Babka , kernel-team@fb.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 05/19] mm: memcontrol: decouple reference counting from page accounting Message-ID: <20200803150349.GA502356@cmpxchg.org> References: <20200623174037.3951353-1-guro@fb.com> <20200623174037.3951353-6-guro@fb.com> <20200803090033.GE5174@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200803090033.GE5174@dhcp22.suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 03, 2020 at 11:00:33AM +0200, Michal Hocko wrote: > On Tue 23-06-20 10:40:23, Roman Gushchin wrote: > > @@ -5456,7 +5460,10 @@ static int mem_cgroup_move_account(struct page *page, > > */ > > smp_mb(); > > > > - page->mem_cgroup = to; /* caller should have done css_get */ > > + css_get(&to->css); > > + css_put(&from->css); > > + > > + page->mem_cgroup = to; > > > > __unlock_page_memcg(from); > > What prevents from memcg to be released here? ->attach_task() and kill_css() are exclusive through the cgroup_mutex, so the base ref cannot disappear from under us during this operation.