Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp990566pxa; Wed, 5 Aug 2020 18:41:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcSLoVkTLhlgZDpDEFNaO125uAeLmafzKuY9EqErKjtTFAPW8nNj2YC/AMtcoiAvZZhWvt X-Received: by 2002:a17:906:3b97:: with SMTP id u23mr2145805ejf.31.1596678087653; Wed, 05 Aug 2020 18:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596678087; cv=none; d=google.com; s=arc-20160816; b=MzqOCeEbkj9BUxsbWiIoFynVtVC5XX2bsPvqSTZJEOvjLUE/Dgy3yAJ2IsLu+HK+6d y9I7ZZ0SWPfR+QjHntOs6E+g8EU2y2WPZm01yxptfnZHPhW7YbpUnBAWEZ9LaYxBAyIG dccTEHNHwSZYkILty/iAQqiEE7NZyFKxgDVLYjj/hEWK1iWYbQ8xcrbapfi8tcitjate tyupxb0m4oV88YdToWz65/aQzzb/zXRXyqSPmg+sQO4EY2blPbmZ+gXth96vg8h/TTUz QSz5sS5XLNKps2a4QS36LRSI2nCaMw6WrjeMcvSZXy/3GWtpB8kB3l44ER0itLxQ3hNR SvmA== 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=pw/Jd7bk6Hrl3EvhpNQHJG9yCOWwRj7bNwS6Bb03dDA=; b=K/bYDDqWkYLRO/XHSXbE39EGT93C9DzEd9GMCBrBRq8JsrO8wccV0mH8pCWaH5prls E2V2CzAV7HxJuRCxwlhhs0q4Z+1hDG6YhLkpdADA11Tv9/DXycBcZiGrDdOryhjKaH1z RdNbgcee/OP/9zB5C7ee7wS5nV1oOdNSSudDs/eyTvSOtDc00MmRQ9Dq3Q+Tq11Mi+JT ZG7C9HpKzuDhRaegNqWt7j3G5iEpCE1q6Y/FDA05IdGhdafDL/PuUpro391mrhxyUoRG IJILilbNFZyn4UYRCU0YQKH7NoB2M8GfXdv0FJjOHCuGoy/8SbEKdCymJ1zFKEouWN2i tUpQ== 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 y22si2219484edv.326.2020.08.05.18.41.03; Wed, 05 Aug 2020 18:41:27 -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 S1726204AbgHFBjj (ORCPT + 99 others); Wed, 5 Aug 2020 21:39:39 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:44365 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgHFBjh (ORCPT ); Wed, 5 Aug 2020 21:39:37 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0U4t4FRM_1596677972; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U4t4FRM_1596677972) by smtp.aliyun-inc.com(127.0.0.1); Thu, 06 Aug 2020 09:39:32 +0800 Subject: Re: [PATCH v17 21/21] mm/lru: revise the comments of lru_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" , Rong Chen , Andrey Ryabinin , Jann Horn References: <1595681998-19193-1-git-send-email-alex.shi@linux.alibaba.com> <1595681998-19193-22-git-send-email-alex.shi@linux.alibaba.com> From: Alex Shi Message-ID: Date: Thu, 6 Aug 2020 09:39:12 +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/8/4 下午10:29, Alexander Duyck 写道: > On Tue, Aug 4, 2020 at 3:04 AM Alex Shi wrote: >> >> >> >> 在 2020/8/4 上午6:37, Alexander Duyck 写道: >>>> >>>> shrink_inactive_list() also diverts any unevictable pages that it finds on the >>>> -inactive lists to the appropriate zone's unevictable list. >>>> +inactive lists to the appropriate node's unevictable list. >>>> >>>> shrink_inactive_list() should only see SHM_LOCK'd pages that became SHM_LOCK'd >>>> after shrink_active_list() had moved them to the inactive list, or pages mapped >>> Same here. >> >> lruvec is used per memcg per node actually, and it fallback to node if memcg disabled. >> So the comments are still right. >> >> And most of changes just fix from zone->lru_lock to pgdat->lru_lock change. > > Actually in my mind one thing that might work better would be to > explain what the lruvec is and where it resides. Then replace zone > with lruvec since that is really where the unevictable list resides. > Then it would be correct for both the memcg and pgdat case. Could you like to revise the doc as your thought? > >>> >>>> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h >>>> index 64ede5f150dc..44738cdb5a55 100644 >>>> --- a/include/linux/mm_types.h >>>> +++ b/include/linux/mm_types.h >>>> @@ -78,7 +78,7 @@ struct page { >>>> struct { /* Page cache and anonymous pages */ >>>> /** >>>> * @lru: Pageout list, eg. active_list protected by >>>> - * pgdat->lru_lock. Sometimes used as a generic list >>>> + * lruvec->lru_lock. Sometimes used as a generic list >>>> * by the page owner. >>>> */ >>>> struct list_head lru; >>>> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h >>>> index 8af956aa13cf..c92289a4e14d 100644 >>>> --- a/include/linux/mmzone.h >>>> +++ b/include/linux/mmzone.h >>>> @@ -115,7 +115,7 @@ static inline bool free_area_empty(struct free_area *area, int migratetype) >>>> struct pglist_data; >>>> >>>> /* >>>> - * zone->lock and the zone lru_lock are two of the hottest locks in the kernel. >>>> + * zone->lock and the lru_lock are two of the hottest locks in the kernel. >>>> * So add a wild amount of padding here to ensure that they fall into separate >>>> * cachelines. There are very few zone structures in the machine, so space >>>> * consumption is not a concern here. >>> So I don't believe you are using ZONE_PADDING in any way to try and >>> protect the LRU lock currently. At least you aren't using it in the >>> lruvec. As such it might make sense to just drop the reference to the >>> lru_lock here. That reminds me that we still need to review the >>> placement of the lru_lock and determine if there might be a better >>> placement and/or padding that might improve performance when under >>> heavy stress. >>> >> >> Right, is it the following looks better? >> >> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h >> index ccc76590f823..0ed520954843 100644 >> --- a/include/linux/mmzone.h >> +++ b/include/linux/mmzone.h >> @@ -113,8 +113,7 @@ static inline bool free_area_empty(struct free_area *area, int migratetype) >> struct pglist_data; >> >> /* >> - * zone->lock and the lru_lock are two of the hottest locks in the kernel. >> - * So add a wild amount of padding here to ensure that they fall into separate >> + * Add a wild amount of padding here to ensure datas fall into separate >> * cachelines. There are very few zone structures in the machine, so space >> * consumption is not a concern here. >> */ >> >> Thanks! >> Alex > > I would maybe tweak it to make sure it is clear that we are using this > to pad out items that are likely to cause cache thrash such as various > hot spinocks and such. > I appreciate if you like to change the doc better. :) Thanks Alex