Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36683412rwd; Tue, 11 Jul 2023 04:30:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlH2qaxurS8+6USwtpGGo2uNmzMB7RqFLEFY7a+EIVR9TaUsqa0BZQtBSUEh7bPJfCx0pmKA X-Received: by 2002:a05:6a20:8402:b0:12b:40d3:aeb1 with SMTP id c2-20020a056a20840200b0012b40d3aeb1mr23208801pzd.25.1689075006128; Tue, 11 Jul 2023 04:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689075006; cv=none; d=google.com; s=arc-20160816; b=GGa72INPNgBqaUHRfbdQiLld7251FEKj0LGi6TiMUQwQFC2vik/XJ3MVghc7+cKMZP aXpjLc4A6pjHncH53EvCCoKQ367dZjt2/Y0FQsr0XSpT2FQWl8vbeqb4x3AmEX7Uel+6 IDsWfNqfBBzvhGDMbWxTn+WHRM6CAq/h4hdJ3yp/vA+cj2AiarEIgQJiZzoRr3eT+6H8 rix6JL8tgfPHhhJrxFe/ikpFQlAahW6T+YiHvXZ4fIw6pHmqjc+DmdZq7CZstXkn+b1K EhlbOOTiuoX6zOSnJNQJxzno12Vwbrz6lny6Koa6ja2FHrv3bTDHY8LAT/uq1+B+oBtC wZpg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Y4gWIaFptjaLY0gO4SYc7/oxN1BeIn2RxSIV3l1pbVI=; fh=Sg2bUVYUsD+HF3IIUIe+Gx6mhI+KYeqAdFvCBtfVhYE=; b=SzRc47TmDvtziRu19axmuOeX7KooyipwAY7B4BR2mURvvC47L64gHw7eRxLyJJN6Yn ebL526smpMABeJj2gWx+bPaviOorX39DcSbOr5DwMsw+6YpfdlLuFPBIVQ9LTgP7R+78 mS/WLjxg6HbtX4DHgBwU1gwUfxvDVZybty1E4WgLzBGPL7gbnAAzmA4Mke9T1/8VdQZ5 6pKLAc65iO/ymGthe9v11sOwI1SegsvFJgKXtqwwZVHpGEwJmBEGjyhPhI4YBxqgPLHB TQnJO1UrmLDdbI4sIIZfzNuZYeU3BhSuYRs/6mn1MKpE3VWdrOSBr9SsuotAAlPkAlgi 9r/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cQQ19ZWD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e126-20020a636984000000b00553800fe4dcsi1246456pgc.583.2023.07.11.04.29.53; Tue, 11 Jul 2023 04:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cQQ19ZWD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbjGKLHW (ORCPT + 99 others); Tue, 11 Jul 2023 07:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229931AbjGKLHU (ORCPT ); Tue, 11 Jul 2023 07:07:20 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9B7E9B for ; Tue, 11 Jul 2023 04:07:19 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 882342221F; Tue, 11 Jul 2023 11:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1689073638; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y4gWIaFptjaLY0gO4SYc7/oxN1BeIn2RxSIV3l1pbVI=; b=cQQ19ZWD+YHfE1cYUbh+IxopPTDFVhV2vnrzifZbWdZt8+yBaSsyAJaYuuBvuZ1WYTaovp XKiASvwBg/VIykrenMYP/mqnAA7NZ2ot7tSFiOuxUbdqgK3ksGDx9YgbXJ5TnWIF0FHIVi t3Br1c8D8D4jAn7PfT1+iySi+dMCHN0= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6B8AC1390F; Tue, 11 Jul 2023 11:07:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Xts8F+Y3rWTqEAAAMHmgww (envelope-from ); Tue, 11 Jul 2023 11:07:18 +0000 Date: Tue, 11 Jul 2023 13:07:17 +0200 From: Michal Hocko To: Huang Ying Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Arjan Van De Ven , Andrew Morton , Mel Gorman , Vlastimil Babka , David Hildenbrand , Johannes Weiner , Dave Hansen , Pavel Tatashin , Matthew Wilcox Subject: Re: [RFC 1/2] mm: add framework for PCP high auto-tuning Message-ID: References: <20230710065325.290366-1-ying.huang@intel.com> <20230710065325.290366-2-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230710065325.290366-2-ying.huang@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 Mon 10-07-23 14:53:24, Huang Ying wrote: > The page allocation performance requirements of different workloads > are usually different. So, we often need to tune PCP (per-CPU > pageset) high to optimize the workload page allocation performance. > Now, we have a system wide sysctl knob (percpu_pagelist_high_fraction) > to tune PCP high by hand. But, it's hard to find out the best value > by hand. And one global configuration may not work best for the > different workloads that run on the same system. One solution to > these issues is to tune PCP high of each CPU automatically. > > This patch adds the framework for PCP high auto-tuning. With it, > pcp->high will be changed automatically by tuning algorithm at > runtime. Its default value (pcp->high_def) is the original PCP high > value calculated based on low watermark pages or > percpu_pagelist_high_fraction sysctl knob. To avoid putting too many > pages in PCP, the original limit of percpu_pagelist_high_fraction > sysctl knob, MIN_PERCPU_PAGELIST_HIGH_FRACTION, is used to calculate > the max PCP high value (pcp->high_max). It would have been very helpful to describe the basic entry points to the auto-tuning. AFAICS the central place of the tuning is tune_pcp_high which is called from the freeing path. Why? Is this really a good place considering this is a hot path? What about the allocation path? Isn't that a good spot to watch for the allocation demand? Also this framework seems to be enabled by default. Is this really desirable? What about workloads tuning the pcp batch size manually? Shouldn't they override any auto-tuning? -- Michal Hocko SUSE Labs