Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3208468ybc; Thu, 21 Nov 2019 05:06:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwLdcGvIVQghRFCaY1hrSXBimOUg5V1IIQ7OYjhAunQxhCRulSSPoFrBxZXc7KfYF7ndekt X-Received: by 2002:a05:6000:1206:: with SMTP id e6mr10613905wrx.113.1574341563265; Thu, 21 Nov 2019 05:06:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574341563; cv=none; d=google.com; s=arc-20160816; b=hzvLwLPLtDvXhUAb5eTKHryjN75YB6jadUBzMt3dV2SnD5N/PTVbw8CNg2Y1Pw+8Kd jkKf/3F/sHUJhEu/D8KAIIVQDIyvkITdITDO+OdQ47or80wFRdoepzGSWrxNcacvTEZJ 6vqo54iL7Nwzomsu1uVI7UB9Q+G7dvDZvPwbj7goGjd1PX7/Pf6Rakhfwa3el1SJLTHm +sZ/t1qnFdq4KRVOUk/t4GQHq1PVXmBnB/H+B4a9zDoVLF0jnmuU9kZwziBM8oEGG/B7 jK1aUopD+8efCj/rDv/4QDrG2G+56mnpnjVKevG1ilKMXP/IZ45Lpfy1MdAa75Y3i734 Umpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=RAMnEhnqZMK3SNhAoosWjpMn/u6DO9zKSHBiMetdsdA=; b=b/kMpebX+ld2py35fK7UGBYv4ntrvZMSbQPQyWOJMBZ4M4V/uovLpNq50ioGxvfB7V tKxousdKlHfcuzlSF+3nccaKlGEWcbCLmnkHbnMXs/MJ4hwidYJyHd3DGxddFCMAnIVH vbWRKNt4rf1XpBhfC/BAp+soIzrROy2o9CPq2PmbVnuoDMkRPH8RAzn7GPuUqvSjw0p9 vbLOlO9/NrPrz1CnLsXj/LyydDFD4zNC9yYfdshm4fPUHBKgLjHEjzRSAo5ufTSrl6Sr JguJp/u/coaeKEPwW65+7vYA0VBcNoqk2ICDf+rqOBWvXM/HiWM50cJ8Pr16xzv8eGPs BH9Q== ARC-Authentication-Results: i=1; mx.google.com; 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi17si2212919edb.430.2019.11.21.05.05.35; Thu, 21 Nov 2019 05:06:03 -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; 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726858AbfKUNDo (ORCPT + 99 others); Thu, 21 Nov 2019 08:03:44 -0500 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:39098 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbfKUNDo (ORCPT ); Thu, 21 Nov 2019 08:03:44 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07487;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0Tij7W01_1574341419; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0Tij7W01_1574341419) by smtp.aliyun-inc.com(127.0.0.1); Thu, 21 Nov 2019 21:03:39 +0800 Subject: Re: [PATCH] mm: fix unsafe page -> lruvec lookups with cgroup charge migration To: Hugh Dickins , Johannes Weiner Cc: Andrew Morton , Shakeel Butt , Michal Hocko , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com References: <20191120165847.423540-1-hannes@cmpxchg.org> From: Alex Shi Message-ID: <14b15e52-9fff-5497-d30c-2c7c4b99c35a@linux.alibaba.com> Date: Thu, 21 Nov 2019 21:03:36 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > It like the way you've rearranged isolate_lru_page() there, but I > don't think it amounts to more than a cleanup. Very good thinking > about the odd "lruvec->pgdat = pgdat" case tucked away inside > mem_cgroup_page_lruvec(), but actually, what harm does it do, if > mem_cgroup_move_account() changes page->mem_cgroup concurrently? Maybe the page could be added to root_mem_cgroup? > > You say use-after-free, but we have spin_lock_irq here, and the > struct mem_cgroup (and its lruvecs) cannot be freed until an RCU > grace period expires, which we rely upon in many places, and which > cannot happen until after the spin_unlock_irq. > > And the same applies in the pagevec_lru_move functions, doesn't it? > > I think now is not the time for such cleanups. If this fits well > with Alex's per-lruvec locking (or represents an initial direction > that you think he should follow), fine, but better to let him take it > into his patchset in that case, than change the base unnecessarily > underneath him. > > (It happens to go against my own direction, since it separates the > locking from the determination of lruvec, which I insist must be > kept together; but perhaps that won't be quite the same for Alex.) > It looks like we share the same base. Before this patch, root memcg's lruvc lock could guards !PageLRU and it followings, But now, there are much holes in the wall. :) Thanks Alex