From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Shi Subject: Re: [PATCH v16 18/22] mm/lru: replace pgdat lru_lock with lruvec lock Date: Mon, 20 Jul 2020 13:47:09 +0800 Message-ID: <27eb389d-b5f9-fe03-2e57-15c351629efc@linux.alibaba.com> References: <1594429136-20002-1-git-send-email-alex.shi@linux.alibaba.com> <1594429136-20002-19-git-send-email-alex.shi@linux.alibaba.com> <62dfd262-a7ac-d18e-216a-2988c690b256@linux.alibaba.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="utf-8" To: Alexander Duyck Cc: Andrew Morton , Mel Gorman , Tejun Heo , Hugh Dickins , Konstantin Khlebnikov , Daniel Jordan , Yang Shi , Matthew Wilcox , Johannes Weiner , kbuild test robot , linux-mm , LKML , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Shakeel Butt , Joonsoo Kim , Wei Yang , "Kirill A. Shutemov" , Michal Hocko , Vladimir Davydov , Rong Chen 在 2020/7/19 下午11:14, Alexander Duyck 写道: >> Compare to move to tail, how about to move it to head of struct, which is >> close to lru list? Did you have some data of the place change? > I don't have specific data, just anecdotal evidence from the past that > usually you want to keep locks away from read-mostly items since they > cause obvious cache thrash. My concern was more with the other fields > in the structure such as pgdat since it should be a static value and > having it evicted would likely be more expensive than just leaving the > cacheline as it is. > Thanks for comments, Alex. So, sounds like moving the lru_lock to head of struct lruvec could be better. >> - __mod_zone_page_state(zone, NR_MLOCK, delta_munlocked); >> + if (delta_munlocked) >> + __mod_zone_page_state(zone, NR_MLOCK, delta_munlocked); >> if (lruvec) >> unlock_page_lruvec_irq(lruvec); > Why not just wrap the entire thing in a check for "lruvec"? Yes you > could theoretically be modding with a value of 0, but it avoids a > secondary unnecessary check and branching. Right, and the delta_munlocked value could be checked inside the accounting func Thanks!