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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5165EB64DD for ; Tue, 11 Jul 2023 11:07:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 611016B0071; Tue, 11 Jul 2023 07:07:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C2196B0074; Tue, 11 Jul 2023 07:07:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AFB36B0075; Tue, 11 Jul 2023 07:07:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 37DC86B0071 for ; Tue, 11 Jul 2023 07:07:22 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F3327801E4 for ; Tue, 11 Jul 2023 11:07:21 +0000 (UTC) X-FDA: 80999054682.05.4DB231B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id 1AD724000E for ; Tue, 11 Jul 2023 11:07:19 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=cQQ19ZWD; dmarc=pass (policy=quarantine) header.from=suse.com; spf=none (imf17.hostedemail.com: domain of mhocko@suse.com has no SPF policy when checking 195.135.220.28) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689073640; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Y4gWIaFptjaLY0gO4SYc7/oxN1BeIn2RxSIV3l1pbVI=; b=L+DaJlsfk9BQ1VMAOKztC67pyMJfJlDdsr0+Wx9wTyXtuTAjVM4Xf4Xm9ItVKg52uGwz45 O6Kj/WtaoGCNzr6XjE5sP3jkQW9s6TNfblKEIWV4Z44U9uiEd8qny6x0k1AEBffaXLeuPU cKYbFvuOFGhl9cotbXWeJ3cvQZZfAtI= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=cQQ19ZWD; dmarc=pass (policy=quarantine) header.from=suse.com; spf=none (imf17.hostedemail.com: domain of mhocko@suse.com has no SPF policy when checking 195.135.220.28) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689073640; a=rsa-sha256; cv=none; b=WBbh5843GH3j9uGE8QW7GtUmuio5lKr7zDd+Hh58Ne1POy1K3t+1qIuBoyxS/JCGkDx1eG 0ZVtlv4vDZxK8/ibNa0gn/ipQPz5414XIJt+r394NVS95nCRUeqwkP/t7aVRsJ9605nYbC GozRqEX4oQSLIn6ltMNBu8dfmuK//Kw= 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-Rspamd-Queue-Id: 1AD724000E X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: m316jwhn9t7fxjmmthh3f41bjfmdmctp X-HE-Tag: 1689073639-856614 X-HE-Meta: U2FsdGVkX1+4JyOeGksheURMBnkde/PBwUjx1KFNv/lqmeFoS3TluwX5Y8yPrqI1yb22kfFtT6DA8NGQC9kF9JUkIZrch7o+hxeNqCJpT2xMc7CGu6mh3LAemD+W7DnzY5jZqnvJ0gYf3bfnFAg4IQlZm9EX3bnOuHWmJK8Kk+fYyI7jT0vzY0QsxVHC4WXpc+yP0EqZzw+e/GHqOwMxw48QYrNKNXSgQqOHFyHDGDeABZpOd4f//6q0Q36U/2idDAbRtPkd4XLJUj2T6YxEhtWddlNunrHNX3LDIJ9iSmXOgXPz4K7bhOfH4cc0+8aBqjDgkm46kJOkhztI0BtxDXh48P4mmwE7/pFg25y9XkOsWpdyYFSWOHJoSx0AWlZkgyM4IO7ff68gCHEiGTNpRyE0mGdG5SmrhkWlssKX3Ct/5uoAmeqDC64cB7fxwPEztWjvBYT7OFWayq3FC3L+tRh1diwvMN30VpNQciJvP/q4vWJy230ctWw8uIjeozhRXofbPmJZRvUHFFbEhs1uKwT2MV5yfZoicMUAAoXGr0ntc20NpwE2b53LbkmCWefwzyOWse4h22hOKMTx9kRrljd/QzBSrpWmIvOAm9+l1h2d2rKzV2ffsA1JIry5Pi59VP69BZGqitDe6qw6Z52e8Ot0TYUYsXzKMrE9tfoMQe6uZiJ173q3ARk43vqb7rq0YthkeRrVP7gxh8pRUCwfsyvWCelsa8yPl30vZ4zj6mQ9U+uXWOrz5hl6oHoEdXBHpDyMiiKPml3yN13bYMoFo07krHKos74wEP3EbhOGcAvcNGjWzcnNL8vr3e5cBMVN7EzXeg3TIllFi8R1cmdkCm9CBW+Vqm1zpVjvALCoHUND2OU0GzGTZeBSylAzo0oOqezpV6n2loWimvu63ZrZD84ZeUNldXOBc1yzGtxBIvkdOocFCZ8dN71FkpDcUIQUpcYBZQYYitB9Sm1Zo6H EjaW005u jbQBmGWshY4wsg5ZL2MOL4AvDyCbIWx6sm5L6yRfm2pv/CpSW5NmeTP3ct4rLCUAHv7FsPSAy8QFt20zK1Sr8Ywnn17xTG4Gsv4LPJGzfgvAmnQbst25pflKEQ8v7/ypRXKIQLfwnHn/Uxu4= 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 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