From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E81BCC432C3 for ; Mon, 18 Nov 2019 12:31:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AEC6920855 for ; Mon, 18 Nov 2019 12:31:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hm08IHNp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEC6920855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 403186B000A; Mon, 18 Nov 2019 07:31:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B4086B000C; Mon, 18 Nov 2019 07:31:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A1C66B0010; Mon, 18 Nov 2019 07:31:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 1563B6B000A for ; Mon, 18 Nov 2019 07:31:45 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id C074C82499A8 for ; Mon, 18 Nov 2019 12:31:44 +0000 (UTC) X-FDA: 76169334528.17.crown82_2c4c0c28bc853 X-HE-Tag: crown82_2c4c0c28bc853 X-Filterd-Recvd-Size: 5054 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Mon, 18 Nov 2019 12:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To: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=1uTqX3A6ZeCQPMQGY2vxfYuUrgEAsqvrPYRGzUC2PfE=; b=hm08IHNpYpMkkjKt5slMQ5VyL+ XZpcURx3zHDvY8niGep8cHLmc2fvdk/YyMPRJdnLyDJ+XRBgx26J2VsQwqPAlHHIa+yVFL61DVzMZ 98Nvz5BYK+UVLJYZ+QnkX+SaNHJylb8QoMvDcwAJOq+qWeC5SChQsODKh66OdUYYpAfZn8yCF+rJI ipf1s4uQpak7zVsLlQTp5pXUyheF1CpOFBtgXz1Iw5LHMrwel4Qr3LGiallXM5GfyEEv0wmlrHTWi rTWLaVNleWubK+oCtLZ0T1RQGj6UV0e5UxwQ9GVfZl7Ox1NgVpx7ZElHdoBTXmi2CJ6qtKfECZxJT JYSnoh8Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iWgBu-0002mY-5l; Mon, 18 Nov 2019 12:31:38 +0000 Date: Mon, 18 Nov 2019 04:31:38 -0800 From: Matthew Wilcox To: Alex Shi Cc: Shakeel Butt , Cgroups , LKML , Linux MM , Andrew Morton , Mel Gorman , Tejun Heo , Hugh Dickins , Konstantin Khlebnikov , Daniel Jordan , Yang Shi , Johannes Weiner , Michal Hocko , Vladimir Davydov , Roman Gushchin , Chris Down , Thomas Gleixner , Vlastimil Babka , Qian Cai , Andrey Ryabinin , "Kirill A. Shutemov" , =?iso-8859-1?B?Suly9G1l?= Glisse , Andrea Arcangeli , David Rientjes , "Aneesh Kumar K.V" , swkhack , "Potyra, Stefan" , Mike Rapoport , Stephen Rothwell , Colin Ian King , Jason Gunthorpe , Mauro Carvalho Chehab , Peng Fan , Nikolay Borisov , Ira Weiny , Kirill Tkhai , Yafang Shao Subject: Re: [PATCH v3 3/7] mm/lru: replace pgdat lru_lock with lruvec lock Message-ID: <20191118123138.GL20752@bombadil.infradead.org> References: <1573874106-23802-1-git-send-email-alex.shi@linux.alibaba.com> <1573874106-23802-4-git-send-email-alex.shi@linux.alibaba.com> <3f179d84-85e2-bace-2dbc-e77f73883c71@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3f179d84-85e2-bace-2dbc-e77f73883c71@linux.alibaba.com> User-Agent: Mutt/1.12.1 (2019-06-15) Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Nov 18, 2019 at 08:23:12PM +0800, Alex Shi wrote: > =E5=9C=A8 2019/11/16 =E4=B8=8B=E5=8D=883:03, Shakeel Butt =E5=86=99=E9=81= =93: > >> +reget_lruvec: > >> + lruvec =3D mem_cgroup_page_lruvec(page, pgdat); > >> + > >> /* If we already hold the lock, we can skip some rec= hecking */ > >> - if (!locked) { > >> - locked =3D compact_lock_irqsave(&pgdat->lru_= lock, > >> - &fla= gs, cc); > >> + if (lruvec !=3D locked_lruvec) { > >> + if (locked_lruvec) { > >> + spin_unlock_irqrestore(&locked_lruve= c->lru_lock, > >> + locked_lruvec->irqfl= ags); > >> + locked_lruvec =3D NULL; > >> + } > > What guarantees the lifetime of lruvec? You should read the comment o= n > > mem_cgroup_page_lruvec(). Have you seen the patches Hugh had shared? > > Please look at the trylock_page_lruvec(). > >=20 >=20 > Thanks for comments, Shakeel. >=20 > lruvec lifetime is same as memcg, which allocted in mem_cgroup_alloc()-= >alloc_mem_cgroup_per_node_info() > I have read Hugh's patchset, even not every lines. But what's point of = you here? I believe Shakeel's point is that here: struct lruvec *mem_cgroup_page_lruvec(struct page *page, struct pglist_da= ta *pgdat) { ... memcg =3D page->mem_cgroup; there is nothing pinning the memcg, and it could be freed before dereferencing memcg->nodeinfo in mem_cgroup_page_nodeinfo().