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=-7.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 7BE33C433E0 for ; Thu, 6 Aug 2020 16:27:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8E3CD23117 for ; Thu, 6 Aug 2020 16:27:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZdUtrIiJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E3CD23117 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 643E36B0002; Thu, 6 Aug 2020 12:27:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CCDF6B0003; Thu, 6 Aug 2020 12:27:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 495BD6B0005; Thu, 6 Aug 2020 12:27:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id 306E66B0002 for ; Thu, 6 Aug 2020 12:27:31 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E0CF52480 for ; Thu, 6 Aug 2020 16:27:30 +0000 (UTC) X-FDA: 77120674260.11.plant65_3b1857026fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id B5F9F180F8B81 for ; Thu, 6 Aug 2020 16:27:30 +0000 (UTC) X-HE-Tag: plant65_3b1857026fb9 X-Filterd-Recvd-Size: 8293 Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 16:27:30 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id k23so50147918iom.10 for ; Thu, 06 Aug 2020 09:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ahDyQRQ8qG4y6mT2u2SznObMHtFgTL4ajSNN22kfjp4=; b=ZdUtrIiJcl7Nfj9Rvxj9ES6+kDWC9CU4i6LSL72ge1TPy0kr03vTTQEUex02PjmL3u OREa/2ZjGChbnkDQPpgqTUPhSe1rrAhOluGC/DnFLngXi6g5zwZGyNbmoRXbsTxxdNht fct1LmaMYieptij4rv7VS/p47/4iviUWpBv0w3z9v1hGJLdxx9bBuWkxNdrfMKei+8pm iADYistAX6rxg2A/SFtqiU3NnJBJPQZHYT6bkzKb13tAG6buip1ZlNxlEI45+l4cQThT FLg479wbNG8iJF15uFtunAfz8Lpk+Y+8WpfyljXhAmTw3Eugcyr9C/nhqPKFGXKkKu3+ uUKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ahDyQRQ8qG4y6mT2u2SznObMHtFgTL4ajSNN22kfjp4=; b=F31rVCKoAdvVhr2uaB8uzYIubRjDvrey717zT1c1N5j1oG45/Vxabu7hDZ7Q8ti1Do jK9E/ekJfy/aeuN7XjpvmIOyb/f9KJCIVLTUpTZfCkUeCi3BhDspFAQwy2qNw8MCE+IH Hqytuj0s+dTKSrcpeEZwgd4hHyh1uZkSyARbO41+3DYgAnRH9CFKfuJ1or/+4q6wQ1Fp kG6IUqQR3yTe57mkz/EcxCRHahywUHnu3JWsNsIkiEelAh03nhTSLS+ouyaOwfykdEbB eic9H4aJQ4ZXRTrb5/pYombxuxs0jmZPxoD5RWEq4vrqYctBZNemWYQxRsGMk9SYU99u 2TcQ== X-Gm-Message-State: AOAM5311URwm1jB2bxNAeRsZsChQ8e1QrCVI4ORg21ujBZV7DNEjw8yf A7OvMRu6DFdDEOB4TViowCGyNiwpboBmlA977Cs= X-Google-Smtp-Source: ABdhPJwp0t3SYC5aIhVbXM5FB0FqySqXQ3e9kH+H7ALWmqQU0x59DnrVnktbemL/IXIyov7ZoZdkXqsBZiq+pkoA6oM= X-Received: by 2002:a05:6602:2e83:: with SMTP id m3mr11285893iow.38.1596731248551; Thu, 06 Aug 2020 09:27:28 -0700 (PDT) MIME-Version: 1.0 References: <1595681998-19193-1-git-send-email-alex.shi@linux.alibaba.com> <1595681998-19193-22-git-send-email-alex.shi@linux.alibaba.com> In-Reply-To: From: Alexander Duyck Date: Thu, 6 Aug 2020 09:27:16 -0700 Message-ID: Subject: Re: [PATCH v17 21/21] mm/lru: revise the comments of lru_lock To: Alex Shi 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: B5F9F180F8B81 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: On Wed, Aug 5, 2020 at 6:39 PM Alex Shi wrote: > > > > =E5=9C=A8 2020/8/4 =E4=B8=8B=E5=8D=8810:29, Alexander Duyck =E5=86=99=E9= =81=93: > > On Tue, Aug 4, 2020 at 3:04 AM Alex Shi wr= ote: > >> > >> > >> > >> =E5=9C=A8 2020/8/4 =E4=B8=8A=E5=8D=886:37, Alexander Duyck =E5=86=99= =E9=81=93: > >>>> > >>>> shrink_inactive_list() also diverts any unevictable pages that it f= inds 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 ch= ange. > > > > 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 prote= cted by > >>>> - * pgdat->lru_lock. Sometimes used as a gen= eric list > >>>> + * lruvec->lru_lock. Sometimes used as a ge= neric 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_a= rea *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 in= to 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_are= a *area, int migratetype) > >> struct pglist_data; > >> > >> /* > >> - * zone->lock and the lru_lock are two of the hottest locks in the ke= rnel. > >> - * 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 separa= te > >> * 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. :) Give me a day or so. I will submit a follow-on patch with some cleanup for the comments. Thanks. - Alex