Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1692213pxb; Wed, 9 Feb 2022 02:19:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrBBTu0EhdekoUjAJtbaP1+htzUpJes+XhViQN/XzUxg7aOSXNIx01+xiyry7dW61BCdci X-Received: by 2002:a17:902:ce8b:: with SMTP id f11mr1395515plg.40.1644401995614; Wed, 09 Feb 2022 02:19:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644401995; cv=none; d=google.com; s=arc-20160816; b=Vd6vOiV8PVe22yIlsPBBq2sLhV1ztBVlr1VQr/ES2FIHlAhJVbQMsqGfxDhWlfGkrj /3sTLZUhVqs+6zDJnOou2Amr54LLR3xjs9aUB7ZP8P/QK8kPMvzojGTZxrvPhShOBpe2 S9CIUd2akSV+v8IjgXqHpFFw3x/S6iXgUqP/fXl0PVv8YRhisx4xpAaXJErGY/vVI/3u M8qsKNRhjpwZcv2bLhBbH3gfGjGWAjJ/yFmLEA7WuuWsGEH+SCqouroSibL5ZKJ/QnJN 3NuDYN27ojVmpgh5esptMzwpPyx0qV6sjh9W7vb+12l3rbAl6Gnu0ViA08OYJ+iGpu+Q VrAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O/lx//nLUVMx2EI4vj5HKtagrUsb3ZYCM82TQ4lEins=; b=TytCdFgBHv9oJcyzgo4ZyuDz0lNc2dgVm9ZPYR6zVtYf9JyqFaiBUALANas3/KJ0Iz CtdaTJlO/DgSx90E/iXqiWW2O+KqsgRHwSRoGp6D7N0bTLdLUPuQEJtCWkzrfq1pTeOT Pyxm0EWGqIy1q3bInOhmo5mMbx7N+5PFY7I47mFXJ/XZ8YZcvm0ruO+QDOpZVhzikT7m S1kMiEqtmTIfl8sN9TDCyTryxhKyz178QjEeLn9AKTM1wb6bhl7tU0Cv6XhN1EWj4wLu HiUpYjYfqPOaLx9rR1YZcg7AAbNRja+VC+aLSQpn5qOACI0GlutGKpVtDJG6D5En1t5Y RZ0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="GNZIO6/k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g9si4325553pfo.114.2022.02.09.02.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 02:19:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="GNZIO6/k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B2D70C0DE7FB; Wed, 9 Feb 2022 01:18:13 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353435AbiBHJQc (ORCPT + 99 others); Tue, 8 Feb 2022 04:16:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232179AbiBHJQb (ORCPT ); Tue, 8 Feb 2022 04:16:31 -0500 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C32C03FEC3 for ; Tue, 8 Feb 2022 01:16:29 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id d188so20286670iof.7 for ; Tue, 08 Feb 2022 01:16:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=O/lx//nLUVMx2EI4vj5HKtagrUsb3ZYCM82TQ4lEins=; b=GNZIO6/kuk+ic9l6Cd+p/G1mclOH/q3G/vT9SOJqWStL42meaNn/c/wFxfOu3vH9z1 uOLAzQrhJq95IkE+TOApdAN1ebRCQvgTw7uDwp8aJjVbau9Q2hRunsd/UW0wOVvjYwd1 LcpnpZOyuC0DTMEJBpVE1aNfStAYiHEPBjeyFGgD6lSx1oXM4Le3EOGAoBFH3e2WoeDV uIQBx1oy/xTb+3xXbPXk86a1+F/MI5UOjandFhzeQffQ3GTJisprjuAegNuPLc1FAiS7 JphN+alAke3aQBct32r7k9yuTI6pGb/AYKbCAvQdosBGvl25eO7UHSAH5rqstI1IASX8 bjWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=O/lx//nLUVMx2EI4vj5HKtagrUsb3ZYCM82TQ4lEins=; b=a+iV7S5ZEDzWxsNf7r6fwl+Z5TqHXf0GUrJAbYFeAuKsgDP4XNvCcjefjz5jhbCx2C NuQpiY337y7n7UCA1C4C18sQCRqBgBgcJrwwcyidI4OmTHIqOAIIRIQzahcbF3GTx4g9 Z1ufQ2AjFbIWgqdyzjceXJN4U8J0Aeuv0gPGQhXpHs/jpo3sXHUnSdRSQHZ/1G96EMLM D/PzyiEfVYrZ/dm/NiZbgcHnMSl1cpm41ILT0m8NL0to0X6b2rgMZcrUCdgR0JOpsl5w 2f1TYfl3eq0/T9UL+mouAEN4ZiNk+6GhHur7DKub5KFlJh7pV0ldE2PWxGt4zMkUmpYI 7M/g== X-Gm-Message-State: AOAM530alzpM0e7dcsv8Oxcw70js+ih/5XXiDGU74Mfs0jBQz0PgbMNJ tltAUG42HSb/PgUOcaDAiuJO7A== X-Received: by 2002:a05:6638:1028:: with SMTP id n8mr1757754jan.318.1644311788671; Tue, 08 Feb 2022 01:16:28 -0800 (PST) Received: from google.com ([2620:15c:183:200:5f31:19c3:21f5:7300]) by smtp.gmail.com with ESMTPSA id k11sm7556042iob.23.2022.02.08.01.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 01:16:27 -0800 (PST) Date: Tue, 8 Feb 2022 02:16:24 -0700 From: Yu Zhao To: Barry Song <21cnbao@gmail.com> Cc: Andrew Morton , Linus Torvalds , Andi Kleen , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , LAK , Linux Doc Mailing List , LKML , Linux-MM , page-reclaim@google.com, x86 Subject: Re: [PATCH v6 0/9] Multigenerational LRU Framework Message-ID: References: <20220104202227.2903605-1-yuzhao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 09:54:09PM +1300, Barry Song wrote: > On Tue, Jan 25, 2022 at 7:48 PM Yu Zhao wrote: > > > > On Sun, Jan 23, 2022 at 06:43:06PM +1300, Barry Song wrote: > > > On Wed, Jan 5, 2022 at 7:17 PM Yu Zhao wrote: > > > > > > > > > > Large-scale deployments > > > > ----------------------- > > > > We've rolled out MGLRU to tens of millions of Chrome OS users and > > > > about a million Android users. Google's fleetwide profiling [13] shows > > > > an overall 40% decrease in kswapd CPU usage, in addition to > > > > > > Hi Yu, > > > > > > Was the overall 40% decrease of kswap CPU usgae seen on x86 or arm64? > > > And I am curious how much we are taking advantage of NONLEAF_PMD_YOUNG. > > > Does it help a lot in decreasing the cpu usage? > > > > Hi Barry, > > > > The fleet-wide profiling data I shared was from x86. For arm64, I only > > have data from synthetic benchmarks at the moment, and it also shows > > similar improvements. > > > > For Chrome OS (individual users), walk_pte_range(), the function that > > would benefit from ARCH_HAS_NONLEAF_PMD_YOUNG, only uses a small > > portion (<4%) of kswapd CPU time. So ARCH_HAS_NONLEAF_PMD_YOUNG isn't > > that helpful. > > Hi Yu, > Thanks! > > In the current kernel, depending on reverse mapping, while memory is > under pressure, > the cpu usage of kswapd can be very very high especially while a lot of pages > have large mapcount, thus a huge reverse mapping cost. Agreed. I've posted v7 which includes kswapd profiles collected from an arm64 v8.2 laptop under memory pressure. > Regarding <4%, I guess the figure came from machines with NONLEAF_PMD_YOUNG? No, it's from Snapdragon 7c. Please see the kswapd profiles in v7. > In this case, we can skip many PTE scans while PMD has no accessed bit > set. But for > a machine without NONLEAF, will the figure of cpu usage be much larger? So NONLEAF_PMD_YOUNG at most can save 4% CPU usage from kswapd. But this definitely can vary, depending on the workloads. > > > If so, this might be > > > a good proof that arm64 also needs this hardware feature? > > > In short, I am curious how much the improvement in this patchset depends > > > on the hardware ability of NONLEAF_PMD_YOUNG. > > > > For data centers, I do think ARCH_HAS_NONLEAF_PMD_YOUNG has some value. > > In addition to cold/hot memory scanning, there are other use cases like > > dirty tracking, which can benefit from the accessed bit on non-leaf > > entries. I know some proprietary software uses this capability on x86 > > for different purposes than this patchset does. And AFAIK, x86 is the > > only arch that supports this capability, e.g., risc-v and ppc can only > > set the accessed bit in PTEs. > > Yep. NONLEAF is a nice feature. > > btw, page table should have a separate DIRTY bit, right? Yes. > wouldn't dirty page > tracking depend on the DIRTY bit rather than the accessed bit? It depends on the goal. > so x86 also has > NONLEAF dirty bit? No. > Or they are scanning accessed bit of PMD before > scanning DIRTY bits of PTEs? A mandatory sync to disk must use the dirty bit to ensure data integrity. But for a voluntary sync to disk, it can use the accessed bit to narrow the search of dirty pages. A mandatory sync is used to free specific dirty pages. A voluntary sync is used to keep the number of dirty pages low in general and it doesn't target any specific dirty pages. > > In fact, I've discussed this with one of the arm maintainers Will. So > > please check with him too if you are interested in moving forward with > > the idea. I might be able to provide with additional data if you need > > it to make a decision. > > I am interested in running it and have some data without NONLEAF > especially while free memory is very limited and the system has memory > thrashing. The v7 has a switch to disable this feature on x86. If you can run your workloads on x86, then it might be able to help you measure the difference.