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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,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 D5978C433E3 for ; Mon, 20 Jul 2020 05:47:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9E6E420734 for ; Mon, 20 Jul 2020 05:47:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E6E420734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 202DF6B0003; Mon, 20 Jul 2020 01:47:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B4026B0005; Mon, 20 Jul 2020 01:47:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CA576B0006; Mon, 20 Jul 2020 01:47:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id E93F76B0003 for ; Mon, 20 Jul 2020 01:47:32 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 329C0195663 for ; Mon, 20 Jul 2020 05:47:32 +0000 (UTC) X-FDA: 77057371944.08.care61_3c0902526f22 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 08B5C1800EC3E for ; Mon, 20 Jul 2020 05:47:32 +0000 (UTC) X-HE-Tag: care61_3c0902526f22 X-Filterd-Recvd-Size: 3606 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jul 2020 05:47:27 +0000 (UTC) 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=e01e01358;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0U3BbMp-_1595224030; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U3BbMp-_1595224030) by smtp.aliyun-inc.com(127.0.0.1); Mon, 20 Jul 2020 13:47:10 +0800 Subject: Re: [PATCH v16 18/22] mm/lru: replace pgdat lru_lock with lruvec lock 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@vger.kernel.org, Shakeel Butt , Joonsoo Kim , Wei Yang , "Kirill A. Shutemov" , Michal Hocko , Vladimir Davydov , Rong Chen 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> From: Alex Shi Message-ID: <27eb389d-b5f9-fe03-2e57-15c351629efc@linux.alibaba.com> Date: Mon, 20 Jul 2020 13:47:09 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 X-Rspamd-Queue-Id: 08B5C1800EC3E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: =E5=9C=A8 2020/7/19 =E4=B8=8B=E5=8D=8811:14, Alexander Duyck =E5=86=99=E9= =81=93: >> 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. >=20 Thanks for comments, Alex. So, sounds like moving the lru_lock to head of struct lruvec could be bet= ter. >> - __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 accounti= ng func Thanks!