Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1498229ybh; Sun, 19 Jul 2020 22:50:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8YB02JnZO9GaKnBSNImrZ94gpxUdJ82qBrT+rYChfb2zGyVrHHO5urMcIchB7xLNrK13P X-Received: by 2002:a17:906:191a:: with SMTP id a26mr20048840eje.315.1595224208108; Sun, 19 Jul 2020 22:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595224208; cv=none; d=google.com; s=arc-20160816; b=s7IiPnmUUC3Bbhh2HyczAXFTJCT9D36mlkWRr/LskptbZ9eOAe7PXM6D53nwQFQ5r/ aPE7//Ff9c9gvBJ8dgxlskhCiuoGEMVrVmLIKxYKxhVaS2drFooXAJF5sQ34o1AtPT4+ NzD0bXpDQj15PUYo/RHgjVCD+NLWv0n8LcNDVJ0637aP6vN+bgJMLdehCHLhlA3zLHx6 7HS6dS2TYia7XtnoS5+9UOLiG0XLKAUIViGuJ3pznTJGJ2Bn6CtC58nIJ6Y0a0fadC8V snMkhu29VOY4hwvxiC6WtsoR35T8a/ePscRHdpjD/veVGflnDxsysQ7pFForzd3thNEI znuw== 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=xEi6FxeNH9qKGIjTMcvkD9ptzryG7nfQGP3SIGQ1XUw=; b=g0hPbTdq3vqRsbaNAoc/4xrNn0yVrRYDOMInYIIHX7theQ0XdZ7p0tMMUPEqQz+e65 86+HzSDjHsUoHVyEFkU1vke/dfe2NQRJ2vZJKKi5/Y53jDFqo4VkYPMkYU5Qlx+0gabZ DvFffqDPsfBSKrjIGY7/BYiQZpQMv9eJIo8HEhcu11vHdHBOdtmL62vv8bw9WcXIHYm+ mOWZ+TQdUTunX02o22qkyKHO/KZNsvu7q6Lw4unD8x4wAXIyFyV6N7WKFNllFs/mGrEa Qebl7pM8ZVQVXkVhTLmFPr7bLwXlDTGoISu1/rGihHlpsU5LQjppqo3JKLMpxP6WIegD eH4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id d26si10224045edp.518.2020.07.19.22.49.45; Sun, 19 Jul 2020 22:50:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726045AbgGTFrS (ORCPT + 99 others); Mon, 20 Jul 2020 01:47:18 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:44673 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbgGTFrS (ORCPT ); Mon, 20 Jul 2020 01:47:18 -0400 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 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!