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 C7D0FC0218D for ; Wed, 29 Jan 2025 04:31:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 243A628002F; Tue, 28 Jan 2025 23:31:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F4E228002C; Tue, 28 Jan 2025 23:31:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0997828002F; Tue, 28 Jan 2025 23:31:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DF3A828002C for ; Tue, 28 Jan 2025 23:31:22 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 519F91408A4 for ; Wed, 29 Jan 2025 04:31:22 +0000 (UTC) X-FDA: 83059215204.21.C3F6DA3 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf05.hostedemail.com (Postfix) with ESMTP id A2208100010 for ; Wed, 29 Jan 2025 04:31:20 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=jlrhFHmf; spf=pass (imf05.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738125080; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5vRlb/cQ7fwxiTZKA/lhEArmgotGppW1GTkOmo8LD2A=; b=5SSDnG1z8/xYw3tp39wko184FuYVtgKYDLsfHix9J4UrtVnc+kkz2ao9R9TOaOnCUhCvZb AHmybpbCELVyhyu/IaC9T1yxdFPylwwg3n/elD+TSj4Gyv4ZjXMjAD/DOC0e2KL32wdCbk S3iv8wbvtoOazuiRDnpt7XbZRyMHml0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=jlrhFHmf; spf=pass (imf05.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738125080; a=rsa-sha256; cv=none; b=B2uc2fBzWbNTwyMj4F1SWkLm/HTSIqTImdy/QI0fEnIDsUADHIEcf/UeEja8Aq/UyChQPb FqTEkJgK4xMnNs62R88g6TwLIcXGW9Icg6GqEr1Iv1nEJYw16utKAu3yLAscwMEDNd9ZUi y+UHnIAYgXkBlrlPj1Iw5xLZV8nAeNM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id D90EDA4039E; Wed, 29 Jan 2025 04:29:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3067C4CED3; Wed, 29 Jan 2025 04:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1738125079; bh=D/MRpy1g5UDNeeXeB7vsqO4M2sYlPlx0m7x9jq5EUEs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jlrhFHmfexgXfwaxVf/8lFeDhsspzmWTFKE3db16t5QtwPm8jJiaayyKNlq7vDqPa 7eLpRuiQGHXmeR3dJfIJts7Yp3It0nQbARsyzeKC3NRFZ3eovNTtS9NEc0Mz4vxN5h cJELRqgbSkrIh4bdRR9jyvf2xif+TQbN3A+Mc4cc= Date: Tue, 28 Jan 2025 20:31:18 -0800 From: Andrew Morton To: "Huang, Ying" Cc: Nikhil Dhama , Ying Huang , , , Bharata B Rao , Raghavendra , Mel Gorman Subject: Re: [FIX PATCH] mm: pcp: fix pcp->free_count reduction on page allocation, Message-Id: <20250128203118.578a46182beea6a82dcd0b1d@linux-foundation.org> In-Reply-To: <87sepk72ah.fsf_-_@DESKTOP-5N7EMDA> References: <20250107091724.35287-1-nikhil.dhama@amd.com> <20250107210506.3336da0da4332002847c89a3@linux-foundation.org> <87sepk72ah.fsf_-_@DESKTOP-5N7EMDA> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A2208100010 X-Stat-Signature: zbgncxu6x4cjqq67rq9j3f5r7f6sompp X-HE-Tag: 1738125080-610162 X-HE-Meta: U2FsdGVkX19plCgbtKApj5JESTQttsyuc44Xz5OdAphKaC64CNXlkGIfalTi+H5fJgsb49e+NtiDn1H91YNGvhdx3dBfNh6RGNSyKJ+GiRTx3DLR+0raOYFMwFFVxk2e2ofmH9xYElFVCKcfpZFg05wLc4+A5fZWQ/JjQaMTg4+hdplaqPtfWD4DKzZd9ZlFuGZv5forVp+HfL/xeOHbyxpHTROgAHeRY15rqm+oxoitzgPKqprelv07nSZOJU8UV/EQLoxpo6BteiIeF7o2S0186R0v1IgJ1SL5HvmdNUtYLNjIJy/Rf2wyt3xhFjuxGX8DTB0Wq7Z/9+M/9MEOU5klnPTsyaPjxFb2LI696nPnT5rrwCwA0oiwMkF+0cEXGArUnVdLgnJf2vI0J7AGNFifQ/ssnkyuddq0ythT91IO9B9SqhiGdTulWkjadypGIyEQB6PnYmOesoaXqP/4gZReVSkPKAmScCIAsXZAk+SQxcxOMujg2EZcmgeK7WIjfTwqLnhnLNYg8sOvmNkpAOYEY4uAyuGi80N/zz+wyksiBQweLFe8zRVqJkT8phkiYmdytkBImjLiWSHX9aehLudVLfl+vFjTc8pm2eIM7vimzP6nvbbkwpZWRc8TLiDmnxBix86C0f6fQq4oQDOlJCBswtdBT4czD/qzmobAi+C8+pHjEYQnqqokNpnQCoTzmvVswTGZhN6BDlvy1QwdBnfWrQwRbf+eyUl1ggnmZqGIXYBWX+/voqXnTLXugfPlk/Dchf6AgyYiYn30n9msnq44c8hFo5xllrct23q+1g84f0JYyyh1hCxeROSUR25IVEn9mJ1sMo7UGglROuUgvWYNNfhYxhbN/qioUujwENY7uZcJGAQ+9EVH3UiwRniAqT29+MfNHyXA7XxI5ALZ4h8wp9pWZdRc8r6W2SeWRU6KHc4/CDyG0q1GSluFxpikTU0wqqGRawuVM9mmSj+ gYA9Q1Of tHMVKMEUiWA6S4OY+WeJkWVDIZZPHrsM2y3mlhN4h65yxhPXX//jqSlGTavOTUgihclO92Q+6uBFF7iyhUaIWeTcYZsJ7rc763wmuB3fxmPr2bSu5gDGih99P+30GPOGfBNeleekHBAs7TznXpnIqnm9ecTdNN//LE60Wh9pEt3AschCAITZtWyiAd1YuKyLWKlmfS8RZjWW/ygl3vp7pQTmJlvek1qM7ubGATM5uY28mgg3VVZsKzIlq9NFKuq1N9RV5tDmAw5ZqWC60Am4vET/ZiJ7OXrd+8cpk5kNzSkLI4jTsIZ7dl749epr2S1USbxZnsgzk+lI1ApzO3D/M/Kz7eVWLU9RPlArBd0nwr9jxz9l9bmEi3pGzrsBYB8DDq4abCkSpx32QoK03d7q8JGi675mbQUVtKmiL3ltd+fhwj3tMqO36DDDdfuRCoIHEn0dqOwVsIK5LuOugQ8/h2hFS7Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, 15 Jan 2025 19:19:02 +0800 "Huang, Ying" wrote: > Andrew Morton writes: > > > On Tue, 7 Jan 2025 14:47:24 +0530 Nikhil Dhama wrote: > > > >> In current PCP auto-tuning desgin, free_count was introduced to track > >> the consecutive page freeing with a counter, This counter is incremented > >> by the exact amount of pages that are freed, but reduced by half on > >> allocation. This is causing a 2-node iperf3 client to server's network > >> bandwidth to drop by 30% if we scale number of client-server pairs from 32 > >> (where we achieved peak network bandwidth) to 64. > >> > >> To fix this issue, on allocation, reduce free_count by the exact number > >> of pages that are allocated instead of halving it. > > > > The present division by two appears to be somewhat randomly chosen. > > And as far as I can tell, this patch proposes replacing that with > > another somewhat random adjustment. > > > > What's the actual design here? What are we attempting to do and why, > > and why is the proposed design superior to the present one? > > Cc Mel for the original design. > > IIUC, pcp->free_count is used to identify the consecutive, pure, large > number of page freeing pattern. For that pattern, larger batch will be > used to free pages from PCP to buddy to improve the performance. Mixed > free/allocation pattern should not make pcp->free_count large, even if > the number of the pages freed is much larger than that of the pages > allocated in the long run. So, pcp->free_count decreases rapidly for > the page allocation. > > Hi, Mel, please correct me if my understanding isn't correct. > hm, no Mel. Nikhil, please do continue to work on this - it seems that there will be a significant benefit to retuning this.