Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp703421ybc; Tue, 19 Nov 2019 07:58:35 -0800 (PST) X-Google-Smtp-Source: APXvYqynCeeooIpVsjtMwi1LSVxPVr8ykXsDbn+Hyl6o8bllXpJxKTgAgVi+0pOOJlifZBxKobrO X-Received: by 2002:a17:906:c7d0:: with SMTP id dc16mr36074823ejb.73.1574179115114; Tue, 19 Nov 2019 07:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574179115; cv=none; d=google.com; s=arc-20160816; b=K0OuJvIOhA9RO4Z1Mph+WL/QlnWbd/YlKbzMWzHPqlM+Nx0g1bizsHdrQ98APOYxly zcHleDH3qcYGf35cdSzbcN2Cta7t1fIsGhT7R5gyRQkwRODb+hvZaFKTrdq4LLc1N9Sr Whx7+oGRydoQX7WM6riydCp0ypniPfq6Gdj3i5qWzN4EWStJ8x0uBLeaAlkcWMjXmHWf RVS74sPpvWe2+IIloQrYMcR6rjWEi0HuF4PsFuOPyXWzcKNrUZo6wmu0Fl3WauoPCvhg qqLV105kWjzPwK0wetUp5lcKDi/fe2GYe5EncJG4E3RoajpNRZZQCMkiSP3R5jyaFCrx Df7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=W1uhPT3svlAF0ny/aKL/GHGJkaklH1eD5N8ZBRDMDjQ=; b=Rz/KdqEL8vZ0Y7t+9ygX/MaYBgMc64xabbxnNM8s0fX+fazmGa849EKbdXokT5qdQR vmby4Xo4zaBj78D0+opVyDkhXuGuRXca2fl/yJoTJV/5dabuwNRhl6jj478Rp30+2Jl6 V5PuRl/RdRywGrGnS8hJDkFEsdfK4k70R736FUpSzSX0EEtS18d+hcLYs1clTFSgFImT r/9X104bX63fI80PYoQ7JYBKK9DLuA59YJBxAk5GD9WxRR18IYKFlfLnq9a1ZEvdi4tN sW9lSIeAiW9m25uG3U4Yx7BS2ZLI065kUm3MgrBUlW5BMptQlhzg1GTSew6LOia3luF0 VP9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="Xfdf/vrh"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2si13806005ejx.364.2019.11.19.07.58.10; Tue, 19 Nov 2019 07:58:35 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="Xfdf/vrh"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728126AbfKSP5K (ORCPT + 99 others); Tue, 19 Nov 2019 10:57:10 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:46068 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727509AbfKSP5J (ORCPT ); Tue, 19 Nov 2019 10:57:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=W1uhPT3svlAF0ny/aKL/GHGJkaklH1eD5N8ZBRDMDjQ=; b=Xfdf/vrhOYcquHoQNoWpTcYtN kuKDO7Bj0HAO9PGeYCNBHKD8xBrQdnj0NBMreHHZsj6FewQ1lt2CJRl5hZh7TsQLGgENhL3m9Y2vg hgFjZX+aDnEaE4AoEMRRRAl7sFpRoDW7RF27nGb6Djf9AI9Tj5n16mNuwfZMKDqQd48sFww3pKSoO A3tzKcDLGANz00inclHZMDPUpgPNRT5lBfyG4pYvTruFLURextxyUhR1r2/NAqX65anAsLCtSBbTG fcpQx31yG7SOO80NCnOArA/EM6w9iLaF4Y5dqIt2zQua0YL/9XPDRqNicbv1QzgepjAfcZST2eANh LdHbfPRqw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iX5sG-0003B8-Ga; Tue, 19 Nov 2019 15:57:05 +0000 Date: Tue, 19 Nov 2019 07:57:04 -0800 From: Matthew Wilcox To: Alex Shi Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, yang.shi@linux.alibaba.com, shakeelb@google.com, hannes@cmpxchg.org, 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 v4 3/9] mm/lru: replace pgdat lru_lock with lruvec lock Message-ID: <20191119155704.GP20752@bombadil.infradead.org> References: <1574166203-151975-1-git-send-email-alex.shi@linux.alibaba.com> <1574166203-151975-4-git-send-email-alex.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1574166203-151975-4-git-send-email-alex.shi@linux.alibaba.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 19, 2019 at 08:23:17PM +0800, Alex Shi wrote: > +static inline struct lruvec *lock_page_lruvec_irqsave(struct page *page, > + struct pglist_data *pgdat, unsigned long *flags) > +{ > + struct lruvec *lruvec = mem_cgroup_page_lruvec(page, pgdat); > + > + spin_lock_irqsave(&lruvec->lru_lock, *flags); > + > + return lruvec; > +} This should be a macro, not a function. You basically can't do this; spin_lock_irqsave needs to write to a variable which can then be passed to spin_unlock_irqrestore(). What you're doing here will dereference the pointer in _this_ function, but won't propagate the modified value back to the caller. I suppose you could do something like this ... static inline struct lruvec *lock_page_lruvec_irqsave(struct page *page, struct pglist_data *pgdat, unsigned long *flagsp) { unsigned long flags; struct lruvec *lruvec = mem_cgroup_page_lruvec(page, pgdat); spin_lock_irqsave(&lruvec->lru_lock, flags); *flagsp = flags; return lruvec; } Almost certainly easier to write a macro though. You shouldn't need the two prior patches with this kind of change.