From patchwork Tue Jan 7 09:17:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikhil Dhama X-Patchwork-Id: 13928520 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 6CD30E77197 for ; Tue, 7 Jan 2025 09:18:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C964A6B00AC; Tue, 7 Jan 2025 04:18:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C46818D0001; Tue, 7 Jan 2025 04:18:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC0976B00B7; Tue, 7 Jan 2025 04:18:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 876DF6B00AC for ; Tue, 7 Jan 2025 04:18:12 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 38F0380834 for ; Tue, 7 Jan 2025 09:18:12 +0000 (UTC) X-FDA: 82980104424.08.C2938C5 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2078.outbound.protection.outlook.com [40.107.92.78]) by imf21.hostedemail.com (Postfix) with ESMTP id 538AC1C0008 for ; Tue, 7 Jan 2025 09:18:09 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=RdmI1bhK; spf=pass (imf21.hostedemail.com: domain of Nikhil.Dhama@amd.com designates 40.107.92.78 as permitted sender) smtp.mailfrom=Nikhil.Dhama@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736241489; 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: references:dkim-signature; bh=37f6aRfi3HzV/Gr/wfTE1UANZ0EDleELHYVz0VaD/Yw=; b=0oe8XTbuTIjbMRnNexE+qE3aHs4jRox6dw6CUIVVh1bJu0vOobQA2i94gRl1np3lNnSQiJ iLpvne+VOB+7eQM7a/NHYjIGbxzd2PKLb+Ht0d3Pc+k7p7Zs8BXehbejYu7xAchJGiHsxN EVwefE3hJIVDT7b/63SZaHRyfmTYgoc= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=RdmI1bhK; spf=pass (imf21.hostedemail.com: domain of Nikhil.Dhama@amd.com designates 40.107.92.78 as permitted sender) smtp.mailfrom=Nikhil.Dhama@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736241489; a=rsa-sha256; cv=pass; b=YiYtCsdIwUOa0/pfjLbICy5dFp+5TJJ13wVrY9XMuTnk0JZ5pvgbtk4l2SslEJTJMBCjbA UPR5Mb4OrTVi3tnz8rFgTAaeG6/OjST3Yf1tCxd19zk/1+BpXgSvT5w1+k90p0SzLJ2Sj1 oL7OVO/PNksQOmdrGx2z8rXTcnlRS1k= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k8U5jdIvx9X7crslzvy7rNJ0kaNxp+TEh+oZKuep52wF+ByIWhcNaAJTf2KcA93G8TvOw3HSFQju8sRHRt6K6amte7qGdwpbplsnl9FOGMEg40822+meXKzC6z8gube+v97IlMIFH6qY8VIfzrAdkMDzE5HvZ8ZZNrHm6a9dhZPZ5Dxf+DPCS6MaO6yq7ezcDJ6hBhj/JR64nX2Qf0nBxG3G3Y5H/wPaUm2YRKboKqDGxj3BHqmaiffFinmQdxXISs4PYt+YXVUKRxPlNjugMF49DC98cVMburrCaNfh8P9HiDArj1BpYMD9morVfWfqd4AxWUTFGS2YgokRpQxSXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=37f6aRfi3HzV/Gr/wfTE1UANZ0EDleELHYVz0VaD/Yw=; b=q0IRec+G8L/dx7JrBX0oISSv6/N1R2yuU97WODAZxLK4nphcafUuQX455u00Dcm7n+yL8F79HvHOr+SraedNVbzRME8+FTy+crGflufD0TqH8yuUw3cYMKgmN+sa8hV0h9XllLj28TwZ81lSrjvEyu0VeEG6JJLZ0WlngH6aLNRUJq2cLDlI6XBFs4drW+4s7Z82qFKbDKmHmwaW41xxmsQsIeWVsnDBBDpWi/sM00doMoPULTFhmCx8ljP9smBJhtaKJBnVdReO1b7Sq+uEBvftcqv/5cLn6VwtLc1Ggopc9CQEam1gaDB9zlYJCZxLjfivcvZdEefpAdKm/J8b4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=37f6aRfi3HzV/Gr/wfTE1UANZ0EDleELHYVz0VaD/Yw=; b=RdmI1bhKbDW49WL9EJkDuwjcq8IgdKYCK+GK9kLpdnQ0LbPrxCc977YJeZjL+Kd9VsFlgNUpgyf8jIGDT935kfmvFCKiPdZgEKhZ6UzOPied9n7S1ntAsqNKQCNBg9ho8Km8XRDvIbwk6PG5KUgKRM1vjMT58BicA1R4n1Ougfw= Received: from SJ0PR05CA0062.namprd05.prod.outlook.com (2603:10b6:a03:332::7) by CYYPR12MB8922.namprd12.prod.outlook.com (2603:10b6:930:b8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 09:18:02 +0000 Received: from SJ1PEPF0000231D.namprd03.prod.outlook.com (2603:10b6:a03:332:cafe::6a) by SJ0PR05CA0062.outlook.office365.com (2603:10b6:a03:332::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.10 via Frontend Transport; Tue, 7 Jan 2025 09:18:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF0000231D.mail.protection.outlook.com (10.167.242.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 09:18:02 +0000 Received: from spgblr-titan-01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 7 Jan 2025 03:17:58 -0600 From: Nikhil Dhama To: CC: Nikhil Dhama , Ying Huang , , , Bharata B Rao , Raghavendra Subject: [FIX PATCH] mm: pcp: fix pcp->free_count reduction on page allocation Date: Tue, 7 Jan 2025 14:47:24 +0530 Message-ID: <20250107091724.35287-1-nikhil.dhama@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF0000231D:EE_|CYYPR12MB8922:EE_ X-MS-Office365-Filtering-Correlation-Id: 62c32cf1-3c73-4b32-0d69-08dd2efc2fb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024|7053199007; X-Microsoft-Antispam-Message-Info: 91UM//GsSSQOtvAMsNeMX3PoQLiUHtXXpcWTV6UsLC28CAKtLRk1HC+VyrDwkkGbt2OacNn8vxZLkhTmeRRFHF7OaH8oRNNEBxYAKyEFHgC5Ua7sfceY8s4BS2xEV69pbvBM+/vl9dTWSM7qV81wydEoj0Hp7WhCTXl9GCm/kFcle8yUOeg+j5MNa/DganisE2sYWAhagJZ72y0zIv/dRwZiDqWCbqs7FDJhyxlxHkxYj2lULxHE91D2yg3dJTOSlrevIdgr2BKruAn8YvchZlxuIpX064vJHm1N6T9jpTu3hPebB1/gU8yOBV7vtcTFOmT2aeFEUOvCLP4bJBVV1yo6JfHYMQt9zwZ9IcBYXjQTsM95w3qbUr2TSBMC8gZgV5ILcPwsF+r0jphxSf51h5t1n7jpVLiJYQ+NXsc92QHTsY2OB/jL1YHuSUkSDj7FePyDvpYwWcSZ7uSTwQKLr4gNSJCbMcsjMobUHrgxTyDHxtov0w6/0P+ef+cPpb2ywnF/NjZa4KA2Fy+WzTcoFfd8kuuuAiA3NYfgnyg+uDJnl//vIqvI34SM41Fiaa4QHbfUl7uR2efcERf7PZFs/iuCdwcLDpI+fASqIibWyD4VAhGWJWwSpWEkYC1XPyolTnMOJND0B1to880qJm+neqz5TZCzU4y10cL7+sHM1LN4w7nZ9xoghJd9Fzl9mQmi8UIF/VUBH30zSHMXeer1dtnxR9m+9ripjdHexB2wcQ3eFKD0gaio21hPgc39+BVkxGgfepWgOVUu6Ef7+PvpEaBKNV7CLTWmwRj7DiohhROFyp/HV5lihS2gALLb+UbHWf+2cAm4orKtobqN1HycyZqKCp/S2wjYMWkF9qL3NBcVfoBV7jwOl0ikQefbVmxTwObuadFbFEboskol0+8z9p3IQkfe5bCccNHdBXGl7n/g5BahkXMhCqWN4w/t2/iIxlCBjBXTOh6q71a1m89elbIRofKXY1t83tIscCMnwScsRC//J3ogrPPMTRP7Kd8la+hbPlljNx/frjHaadmnz0JHeeeR9PjN2IPTC2OBFTaZCM1p2v9bS5Di4Hk/M1vKs5E/wEDjqq8pMbDi5rijGBgzp/ZzmP0VeflYtCjX7V1bSxGUEI5FRgLKRT8SpfptyRv4CDGqixazLYYAd9m/cnH1amQdV/WhWIHJ2GNqsctIDhPpq4l75p7uEr7aOhsXw7XLiyluhNUorofZDnbVp6P0zGRjlluIbQ0bO9wylfRHxK9sIocZWDGaZ2sDBX2/kReupZYAVe1GAvxp3A++S4oCjsM9gQ66I3vhDXsG/JFnOpvYQyFMUymggLJydyDXP6fOtp0ItU+K/JHua30oixpVLO8JLZiWb4GG0ZdfJisgn9kjQA0qs12tGR9elYEiMvXSR2q9AXqdb+SXqPuNzU3nxkr44mX/Z5ekZb/htIZUWEGQdqmw5mqtZooHNWd7UufvyIkvDc6MNN1OdcAb0fADIaSwn8GyyDY69ozyPx0= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024)(7053199007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 09:18:02.2077 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62c32cf1-3c73-4b32-0d69-08dd2efc2fb7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF0000231D.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8922 X-Rspamd-Server: rspam05 X-Stat-Signature: bo8rwppxrqwefp18trw9fkimsxtybkj4 X-Rspamd-Queue-Id: 538AC1C0008 X-Rspam-User: X-HE-Tag: 1736241489-434487 X-HE-Meta: U2FsdGVkX18wPbzWWBJnQ0bPflfvOQ9UORbbi1EqW6oaNYArxeATSbVl+h9TuKPPHLxcE41zqseSc9uUIbbXIta7KxpHAml3o4rPjHZeBC8ducBQ81VWtSX6GQrGuRd3Pkr0xxfAZYFVvOpgMuonqaiPGauhxql4dHYDPMzhfDlceeceEaY97LJRQiXBOUNUeXtyqyXXKn0/qj3AvSvNUe1ib4VQlLiw3X5nNNtnixEV3niyPp/I6ozvZ+y16cjtCCtW3nU4rSgNhPzt4STIy79xsX/8MWFryPFX8/cTaFI0BB3Sb2UHI+uQGBOPnP4R2oH5FvdnDvWPM9o6vOIcx6sPcUhAZV7qlY1Ic4X/yf/p7Dpso0bsjqUZHdoJg3u1B+9i2xILVF+lh9MDXIc0/j8PWpQPwDc8hc7vT5vcLI3H5icgwvtgt/Ed/JX0YufILGlN/NV+8gmwDi9PZrFEPHOj4lO7R8lB/X4HrLx93lWscYEMnlNCrY2BBSaHHEfjqRcTsAqBpkSXLOywBynE4V2aZt4u8IIPoDe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iE5hqnPwUiJpVywZjgIdTfsq9FKhesSQo5ZexdKkcPekzotFuFb2TlYoWwyBOBGJjX7CCfbHVU4g46qz1zdJ0rbqB+35gJLxNJnzA3O8me9X92bagM/4AwkMTAUsKivUufC4IOtjD03kj3mbePg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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. On a 2-node AMD server, one running iperf3 clients and other iperf3 sever, This patch restores the performance drop. Fixes: 6ccdcb6d3a74 ("mm, pcp: reduce detecting time of consecutive high order page freeing") Signed-off-by: Nikhil Dhama Cc: Andrew Morton Cc: Ying Huang Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Cc: Bharata B Rao Cc: Raghavendra --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index cae7b93864c2..e2a8ec5584f8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3037,10 +3037,10 @@ static struct page *rmqueue_pcplist(struct zone *preferred_zone, /* * On allocation, reduce the number of pages that are batch freed. - * See nr_pcp_free() where free_factor is increased for subsequent + * See free_unref_page_commit() where free_count is increased for subsequent * frees. */ - pcp->free_count >>= 1; + pcp->free_count -= (1 << order); list = &pcp->lists[order_to_pindex(migratetype, order)]; page = __rmqueue_pcplist(zone, order, migratetype, alloc_flags, pcp, list); pcp_spin_unlock(pcp);