Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4857957ybl; Mon, 13 Jan 2020 22:37:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxfr258vGvuqUwNtafXSjimMIYknW20b6CE/1FAQOKnNKlSBPEMUPcNhCqZXqqcGLZidoz/ X-Received: by 2002:a05:6830:1e37:: with SMTP id t23mr16345902otr.16.1578983831721; Mon, 13 Jan 2020 22:37:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578983831; cv=none; d=google.com; s=arc-20160816; b=F3eOm0RmbHBSOWQkALJeQFYWU2L6MvDZW/4KS+W3H3MpFs97xjd51IKgzsMh5ZFLxO GADKYR90KrFxIQaQyZu/dW5TzfCPzPZwhH4TYcwBlD6WzqyieOEyV7CLOO2sllXP8gk3 JtGJ4uMjKmgae9v3aML5Wxyzapb1cfMoURhmynT13P29smdS5JUBJsubIYRKiVLBGgj0 uMcYAivfGV802efvSYWgzHzyKwpLVnq2t+06k1KKhICyTNjVnHYCgN7yZ/DxYD0MLmzG AmRXd7o8MW/545DB3Dh+SqbzD9edQrkZd+yvhnB+5mshBCpux7CDswNPu8AhCl1PtLtd J2yA== 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=9Pc6EIIor+BlzEoL5ca4C/uE5M8C7UzWvHtc6y5i7rM=; b=EHrqM0cCxQfNN6GYESydUsNR94i4tUGgdWK4etI9GQ9CUkLOxm65X7gneQw7oP6cim uPlqlKl0yGGQ5NqP7c9i2agLiRan55WcoqjPacOAGemG/OzBtk5onxnCGxGhrmDQbI0Y fvpEwezYH/skGMKyTQq5UxtMgazVF9nRyvPTdei3i0vW5kKcoowhtPANQk7pozB4s5Wr Enbu9//sjeVxPMacHpnOToF1MvvIbACBJ4l33qRrC5oLR31UJQ/lXUw4PLJSr4wBlpf1 gvkGoomQUnaK+qvWz+ltdLPraJATfXsgwV1Zhab7tuEMPAQe8cLuNlfZP/pcQBmLa7Pm wVrg== 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 w10si8589828otg.295.2020.01.13.22.37.00; Mon, 13 Jan 2020 22:37:11 -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 S1728680AbgANGfj (ORCPT + 99 others); Tue, 14 Jan 2020 01:35:39 -0500 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:56638 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbgANGfi (ORCPT ); Tue, 14 Jan 2020 01:35:38 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04446;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=38;SR=0;TI=SMTPD_---0TnhU9aL_1578983727; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TnhU9aL_1578983727) by smtp.aliyun-inc.com(127.0.0.1); Tue, 14 Jan 2020 14:35:28 +0800 Subject: Re: [PATCH v7 03/10] mm/lru: replace pgdat lru_lock with lruvec lock To: Daniel Jordan 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, yang.shi@linux.alibaba.com, willy@infradead.org, 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" , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , 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 References: <1577264666-246071-1-git-send-email-alex.shi@linux.alibaba.com> <1577264666-246071-4-git-send-email-alex.shi@linux.alibaba.com> <20200113154116.mwly5hl5yfvjkzl2@ca-dmjordan1.us.oracle.com> From: Alex Shi Message-ID: <677cb490-35a4-4186-0935-6d71305a3a3e@linux.alibaba.com> Date: Tue, 14 Jan 2020 14:33:58 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200113154116.mwly5hl5yfvjkzl2@ca-dmjordan1.us.oracle.com> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/1/13 ????11:41, Daniel Jordan ะด??: > Hi Alex, > > On Wed, Dec 25, 2019 at 05:04:19PM +0800, Alex Shi wrote: >> @@ -900,6 +904,29 @@ static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page, >> { >> return &pgdat->__lruvec; >> } >> +#define lock_page_lruvec_irq(page) \ >> +({ \ >> + struct pglist_data *pgdat = page_pgdat(page); \ >> + spin_lock_irq(&pgdat->__lruvec.lru_lock); \ >> + &pgdat->__lruvec; \ >> +}) >> + >> +#define lock_page_lruvec_irqsave(page, flagsp) \ >> +({ \ >> + struct pglist_data *pgdat = page_pgdat(page); \ >> + spin_lock_irqsave(&pgdat->__lruvec.lru_lock, *flagsp); \ >> + &pgdat->__lruvec; \ >> +}) >> + >> +#define unlock_page_lruvec_irq(lruvec) \ >> +({ \ >> + spin_unlock_irq(&lruvec->lru_lock); \ >> +}) >> + >> +#define unlock_page_lruvec_irqrestore(lruvec, flags) \ >> +({ \ >> + spin_unlock_irqrestore(&lruvec->lru_lock, flags); \ >> +}) > > Noticed this while testing your series. These are safe as inline functions, so > I think you may have gotten the wrong impression when Johannes made this point: > > https://lore.kernel.org/linux-mm/20191119164448.GA396644@cmpxchg.org/ > Thanks for reminder! Daniel! I write them to macro, since I guess it's more favorite for some guys. It's do a bit more neat than function although cost a bit readablity. Thanks a lot! :) Alex