From patchwork Tue Aug 29 06:06:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 13368613 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 C6CFDC6FA8F for ; Tue, 29 Aug 2023 06:07:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 30F7D28002F; Tue, 29 Aug 2023 02:07:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C0198E001E; Tue, 29 Aug 2023 02:07:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 160CB28002F; Tue, 29 Aug 2023 02:07:23 -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 01E458E001E for ; Tue, 29 Aug 2023 02:07:23 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CFEA11C9475 for ; Tue, 29 Aug 2023 06:07:22 +0000 (UTC) X-FDA: 81176109924.23.B3A77A1 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) by imf17.hostedemail.com (Postfix) with ESMTP id DF2A540008 for ; Tue, 29 Aug 2023 06:07:19 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=lMViNaWg; spf=pass (imf17.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.243.44 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693289240; 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=EW+oPbdfOFtFGb0qsIMwhXRIEAOqfAeYwznI1x+HCLg=; b=DEXAri9kn0W08MgGUrKFuwf7X6tcy7PeN+EekDezJsjeaRdyoNg3ymX39F69FzPNZX//me L+N+F7L3vku0ctuDb0LbwVBOwHg3r4ZzEq28LZ5sLFbGclCY5cEPJ47ZeyLhMUeyPCngEf lpz70qHiiTnf81MxCeazbtCEYBCNxDw= ARC-Authentication-Results: i=2; imf17.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=lMViNaWg; spf=pass (imf17.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.243.44 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1693289240; a=rsa-sha256; cv=pass; b=JJeqiMOAHKO3rCYjRoP6GgzygKCoT0wEydxDByfmPTk2l4C/Y8UxenGpgT82pxa9NqxAlO mR/+/itKlyVb132jjNerlRimvh3EBs8uJ3RoOu1Ggv58RG2aL09ntE2lgZdGQrDo3WR5NT BhRHN2jgJHRcD0YN+3hO5QorSlVX6Zs= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aGrZ4+Iew/xlYecxmuz35OhACrH//78E8Nlp7IA1luNT6BPV3f7FhDPeJnFQ1xc11jnPMx7tvsSyuhAzGNbWs6FFCLldBsVOcNhRIYhPZZXTvtQdFnyq03ntCFPL4NanQcpW73Tt9OgzOaz5M2Ar2zHUR4dAG/kMJvVxPrNt/vnWWG9RCKfUrbYIQhUlqPaGchkmEVKRje+/k/WkpUCEzvYeyTaPXALngYYFiqzilc+KqgvS/lv4eNj6VUab4TrJv2J/oe1TECqw08Ybi4Ghm56pkyRhiSZeVcRYKx6GdNSsOBKXyiw4WeU9+irki3DZybsxNDhn4NFoRSos+Md6cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=EW+oPbdfOFtFGb0qsIMwhXRIEAOqfAeYwznI1x+HCLg=; b=ED7I41z/OKSUS6G4i64eKzaU29NtH9h7HGt+vyW0eiH8I2sm3i1NBiN71SjhTfpOBRmRHGVCRECyQS0MyBdrYgQhplAFt+Uv4AOdb62FzV/wSJMmSsB9d9bDbf0UyMj2s54JYczIdj5XlRWnzGcFbKgbJGWWhLycdHDG0BPq/BRCiyfYgRIKNtYRQ1Nto515qjJNo2DekeP1b2C+Qyb75ehSPlcHKyvLMfbpEYDOCTPd7BQf8bPFlITWQVH3Omo+xK5g7FGKMOr/AvY4dPqxLRa0n/Yjir6ySUS6iYqzHwYSqWH0wLe37lO+77/S7PqcCp9t5ka6FnZmac4vuYU1DQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.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 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=EW+oPbdfOFtFGb0qsIMwhXRIEAOqfAeYwznI1x+HCLg=; b=lMViNaWgL3rFC8aFZWFjwxP41reGYxNsuvsDxYfx6+kNrs7gsIlAw+0o6v9E4cnJzdnW3+my2AJStt6FE7RCCYY5F73qCtO3J+47XZ9fPLXXQm4Dg+n/Rvud7qU2BtrKcKe2iNuM97UZvsPtUwMvFflRkLtc9lnglyaO7yx0fvw= Received: from DM6PR18CA0023.namprd18.prod.outlook.com (2603:10b6:5:15b::36) by LV8PR12MB9205.namprd12.prod.outlook.com (2603:10b6:408:191::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34; Tue, 29 Aug 2023 06:07:16 +0000 Received: from SN1PEPF00026368.namprd02.prod.outlook.com (2603:10b6:5:15b:cafe::60) by DM6PR18CA0023.outlook.office365.com (2603:10b6:5:15b::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35 via Frontend Transport; Tue, 29 Aug 2023 06:07:15 +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 SN1PEPF00026368.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.16 via Frontend Transport; Tue, 29 Aug 2023 06:07:15 +0000 Received: from BLR-L-RKODSARA.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.27; Tue, 29 Aug 2023 01:07:06 -0500 From: Raghavendra K T To: , CC: Ingo Molnar , Peter Zijlstra , "Mel Gorman" , Andrew Morton , "David Hildenbrand" , , Juri Lelli , Vincent Guittot , Bharata B Rao , Aithal Srikanth , "kernel test robot" , Raghavendra K T , Sapkal Swapnil , K Prateek Nayak Subject: [RFC PATCH V1 1/6] sched/numa: Move up the access pid reset logic Date: Tue, 29 Aug 2023 11:36:09 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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: SN1PEPF00026368:EE_|LV8PR12MB9205:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a883003-66ec-4275-4e56-08dba85631a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +wkeYWTnqPhSp8B+7ml5vhRXVcwlXsOn1CHCSQZdWckMbkO8bTrBCb8m0A8RfhUz44lg5vPT/Wl2QiKpIliBm2beTI7coIcLZtUBJ+5YrgweSd8RS+zS73ywJ1cJRRq41AsfLIMBPA5NOUUzTsQDegFbD8d0/uTPcI/mL9y3w/e78zlRvl0U8vN+1GEF3ZUzMOThyqftuU2ebx4gnlCQ63/LbgxAB56EYGK2azmNn88jKLPwkRS5KKfbl3rrdE/Q/NXkF+JrNx06yqhfKvvMV5JdmU2oLq2PjlximI/42fMZGGrJ78QuyCd6EuIhVtoHp721EU/r/ktSnZAiL8Pj+G8Pv1p0LHH8YZ6BI8zUSyuy9FO6oNtboYAfU752fXX7grxTrgjcAZ4BC8iY7jKxa+DOQWIN7jV4+WQBsjScAQ69xR7SCAIXDdCBxu3YwI92ib4g9dUrGWNLphqGuBJmT8gFuW8PAaLfMbMwKCqjvXbiCCNo0HyzDNxUeAe5vk5QCsxf8BJCf8iXN7gX9smKRwhvInwnaFhr13rjfoWUPv3ljNhZTioayx/eMnBIsik6dn7C86JTqemEr7dCOI6gTezDfRxlq7aSEPAu2GGzDtdgDHkGF2NbfAN6WXap0W9Dvh2mZQQfFl1Xs51d0WS3ClyWmR0Kxn+4w/p5ORGK79Z8aHqxqspvZ5zxxbc7OEzE72rDaC4wmQX0oHWNiot7IqSNA4HXGl9w6+dB9nxw9c5ZwDwzl16jYciWHQvgvardK3M5tGCtWFl2cW9h1Whx0o03ARMwsFNTVYp5QPvfHJA= 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:(13230031)(4636009)(136003)(376002)(396003)(346002)(39860400002)(451199024)(1800799009)(186009)(82310400011)(36840700001)(40470700004)(46966006)(356005)(81166007)(82740400003)(8936002)(110136005)(70206006)(70586007)(478600001)(7696005)(54906003)(316002)(41300700001)(40460700003)(36756003)(26005)(16526019)(8676002)(5660300002)(83380400001)(2906002)(2616005)(47076005)(36860700001)(40480700001)(426003)(336012)(7416002)(4326008)(36900700001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2023 06:07:15.5675 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a883003-66ec-4275-4e56-08dba85631a0 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: SN1PEPF00026368.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9205 X-Rspamd-Queue-Id: DF2A540008 X-Rspam-User: X-Stat-Signature: ixfqbnozbxygznebmwtzwk8mnpfetnhb X-Rspamd-Server: rspam01 X-HE-Tag: 1693289239-471757 X-HE-Meta: U2FsdGVkX1+O75AEtzRW6S2aCCnPb6Ct6tltXDT6PVRiP9chOxywTWsP1P/FnJPkL6wCsctA79QG+XjpNd71MZpShg2T5VgDHZFxU6bC6LgzXmezUQc0B0InMM/okghNO4pAYx15WPeqaEe/1obKoFfy989nCYSKFYyqISulkbjvzoSIW1bpnB9xzWwy6xBNBIPkJoQ92FaHL4zs2SZErl36lVMVpuRIY9gemAO1S5MMewPnnL1RQBmQiZCfgDtDRfu3k3tZ2EFzmYyARkU6mJBY9vVhwz16IKT3T8AngNlw9aS0Z3El6u4pPKkxwRm4qQlGpNw7mOldMSzX/c1XjDoVBHTg3GLBdfbqgkycsx2oYWi04fSl7+MyE8wrMlWXiIDI+0lqW+/VbURa1DPlElEm/Stct/7mf8OjjrU+krmjijOCuepZX1vMLBAP8SmKQjlBfTPSYpXizBJL0Aeg1s9UnFig9XgEBr+kqFFgdi3deaC9Xl7tj5aAYSZNSgB/A+HCh3/ntJZdlfq/pL5L5f/kWiWIMU+bR7jTIGUr/4bjhy4gPHBDj8uZRu9ZJnJAFLzYgWmVMjMVKqSIgLqcnkmPwjmKEXzpSX9Sh+lJE8dcpdBvfVHqjffYlZIH1E21nz22NjWyOyY5DlRIZjd8qsK8EF4f/rV7BgbhFqXkpT8zzTCXsDZ2nE6XliETRnFPsGTJfGNI5VKJ/qrC0fOlFaoAoXMX/40IxwDrSP+8Dc/LghxXt3SBDmhEUrz8WM49FCKTa2rjZUeWCrP1DZmLPKiGSFH5qsr/wib+VVsTl6QXdXqIuOIlXwlOZ7wOUr3Yu9gzyp+hQr+PlpB/Kpg/YN3K8NZkUsis8iVzDGJSw+T9iRGmz3ImK31BWLLUwncS1CPqoDBmEUmsO1ULyuMJjWqBvsbsWy+s1gK+/Nn5AYKYEC9cU56nYRtFVRZsnunnC4mAmtpzEWhVY2g7qpc wldeQ8cL B+IDihyYrNeR2a3qRJZKWkKOAnjvRWD0dXD+NCWbj6/Ddy7ArIBI9U/ZpIKJDLKkYolTHxGYKScO7pZj9YTAyUKQq3VRct0EqnVFyPRI7YJpnOTTZTlNqpR9QawJP93pT99qyQUEUcjuB7eqcQi3SwOPGVn8+zQWd6N788zjHQMutYtm6qzz+c+NYCHXH33BNwR/j7a9z06zNo0xLQ1bOHioCg8UajV4zOl3pMFChiUZnNYp86PTzCwAObNDejT8c4YtQVoXTSYth49M6ndIXPNRgpiKonsLzBiVb0Rl5O2JRFNKbAMG+ppgO8QH9H9vQs4SKChHF3oLKxGFt+ccPVqY3eNME8OprKM4Rv02Awip62mn03g69NbfDOZjihsxoyYy8Naq2zp6i/K3mcpvWZ7RRclrA45TAeNaRYivuvcrzQBThedqO+BxCp/wNWcluhV/8hYu6zAJwlwraL4Su8AzG+yU6gKNd6KRTmc8AvWfp+QU+hKp0kZowhF2G7WUl8ZxH3xHz/c7plwX4/I42tz7PZMwWAfy0DbHmb73S8DDh6Q2sVJwGRgVM61fOnslkyNYV/uE/c3RMvp4= 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: otherwise VMA's access pid clearing could get deferred for a long time when tasks return without scanning. Suggested-by: Mel Gorman Signed-off-by: Raghavendra K T --- kernel/sched/fair.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b3e25be58e2b..2f2e1568c1d4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3068,14 +3068,7 @@ static void task_numa_work(struct callback_head *work) vma->numab_state->next_scan)) continue; - /* Do not scan the VMA if task has not accessed */ - if (!vma_is_accessed(vma)) - continue; - - /* - * RESET access PIDs regularly for old VMAs. Resetting after checking - * vma for recent access to avoid clearing PID info before access.. - */ + /* RESET access PIDs regularly for old VMAs. */ if (mm->numa_scan_seq && time_after(jiffies, vma->numab_state->next_pid_reset)) { vma->numab_state->next_pid_reset = vma->numab_state->next_pid_reset + @@ -3084,6 +3077,10 @@ static void task_numa_work(struct callback_head *work) vma->numab_state->access_pids[1] = 0; } + /* Do not scan the VMA if task has not accessed */ + if (!vma_is_accessed(vma)) + continue; + do { start = max(start, vma->vm_start); end = ALIGN(start + (pages << PAGE_SHIFT), HPAGE_SIZE); From patchwork Tue Aug 29 06:06:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 13368614 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 3AFDCC71153 for ; Tue, 29 Aug 2023 06:07:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A3D9280032; Tue, 29 Aug 2023 02:07:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 754268E001E; Tue, 29 Aug 2023 02:07:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F4AA280032; Tue, 29 Aug 2023 02:07:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 502638E001E for ; Tue, 29 Aug 2023 02:07:36 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 14966C0584 for ; Tue, 29 Aug 2023 06:07:36 +0000 (UTC) X-FDA: 81176110512.29.DA5720F Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2080.outbound.protection.outlook.com [40.107.101.80]) by imf28.hostedemail.com (Postfix) with ESMTP id 01321C0012 for ; Tue, 29 Aug 2023 06:07:32 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=3mGiw0ZX; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.101.80 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693289253; 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=RNKcjTamJ6O4ps8dbHURIi8t9orAhAQlAyfobLURR6E=; b=n/0iV4qze7+GuXssKGiJCn1T2yqhW/lHWlybjv7aKKaBP8WMscaSUcjnu36rlc/CvacGoy FeT5FDWM8yoHYcZWOdsTxzgE5sIuSZfbajjBiFK3u1/dShqzypm2y6DLWFxAHi9WdThiIZ hj2H1rFV3kqEBy8WGaNVE8xvCZVrRvQ= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=3mGiw0ZX; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.101.80 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1693289253; a=rsa-sha256; cv=pass; b=1kJI95ViJSnXFdealrA4a4vLkdQDeYutPSZqcW2GbCiZ2p04E+34yK6EcUCAzEEwJud/AB iZcXCXX1n8C6Jfp94K5HUqYIEx1xKfO0MxiApiywGva0RAzMC/rEc+Je6D0ucReiN7w2Ti oNhemCEFV2l4sRPHuRd7vDeT/9BzHMI= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F1kiLtsi4Z1kYvfFbAVgY9f7V4ZyIU3WE+ATfG8Uj8NvknrOjLRMkP8IsgY7Xa8amYPzzBGaZHB6/K8IGhidf5RzrcyBiw4hqP7dvgxhGpj1ihkOIEyE9uxHOoF9vrZttKpAHZQ4V/51n4Y4TGKI3i7H7rum/PU00DNLaGsd68MuyHzDUWgVPo7ChvZw+2S8RdSP7A/mX3wDYAB6YPhAVkfxpe1N0kVsH6d/B+WArC4C+3Hu38nBdMHPknKPmwe0/jEZs1i4LeKysBw0Rjre3HjlPpYF+1GZoZEtCd8v+AtZXO2mkcWI13LcTIoBfsNyCilxcOD5uxIG7zdsCA5iYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=RNKcjTamJ6O4ps8dbHURIi8t9orAhAQlAyfobLURR6E=; b=BZT9X/14cX6PBuIUUyTk+BIbUBU6hUz9E4C6r0DYZQJ8BKNaIIMmr0c/v//G3lFSkiYoZtMQJRd65BzN4+vR1FqxrdloUEpCRZPcOkibCrARA8cCTR0Ih18Z+AvU4ZZRFQ8Oz4REo+tGlq0WtLRZrGUQYGJ9LxQqgCagzMkXoFprKNvUYtn3nuRoah8uPCfmjPGHpf3t4KTzXLa2iqY5FRhcHMhxJsVg7OdRdhemnAY+MBYupQuhRTbR94TzeOSjVpTzv9p4kYwoT9mUbW4aHHWzT2Jx3jTab48uc6Mqu38HIp0JY//CLcceBINxBu2isRd4LQmIXu+7NltwV5flgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.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 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=RNKcjTamJ6O4ps8dbHURIi8t9orAhAQlAyfobLURR6E=; b=3mGiw0ZXdvJ2/JjVJsRIOWV1/r9OnOhCW0JdEetVwdlFgnpyIC1hbfZxDTsDXRMpxJnqVJh/HMA4/uGq8ZeMMH+XFtDH9/U6GD7MuNup8U/dekizajHudMZIUZj9pnKrpJXdu/ZhIbatT/5pD6zSFvdjpY7w0dWloN3RfG0qkFs= Received: from DS7PR03CA0097.namprd03.prod.outlook.com (2603:10b6:5:3b7::12) by PH0PR12MB8798.namprd12.prod.outlook.com (2603:10b6:510:28d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35; Tue, 29 Aug 2023 06:07:26 +0000 Received: from SN1PEPF0002636E.namprd02.prod.outlook.com (2603:10b6:5:3b7:cafe::e4) by DS7PR03CA0097.outlook.office365.com (2603:10b6:5:3b7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35 via Frontend Transport; Tue, 29 Aug 2023 06:07:26 +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 SN1PEPF0002636E.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Tue, 29 Aug 2023 06:07:26 +0000 Received: from BLR-L-RKODSARA.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.27; Tue, 29 Aug 2023 01:07:20 -0500 From: Raghavendra K T To: , CC: Ingo Molnar , Peter Zijlstra , "Mel Gorman" , Andrew Morton , "David Hildenbrand" , , Juri Lelli , Vincent Guittot , Bharata B Rao , Aithal Srikanth , "kernel test robot" , Raghavendra K T , Sapkal Swapnil , K Prateek Nayak Subject: [RFC PATCH V1 2/6] sched/numa: Add disjoint vma unconditional scan logic Date: Tue, 29 Aug 2023 11:36:10 +0530 Message-ID: <87e3c08bd1770dd3e6eee099c01e595f14c76fc3.1693287931.git.raghavendra.kt@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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: SN1PEPF0002636E:EE_|PH0PR12MB8798:EE_ X-MS-Office365-Filtering-Correlation-Id: 84d78275-2e4f-4253-3882-08dba85637f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yGJI9A0Hcrp7Br9gKC955LxrMkyGtsrMKk0mUOHSaf5QwVVFZtzqEe1EF6Kr6iUE4vHyIqgPEYzKVZft3BcyyHBiWPswCAwP9W5TQ3zkgVubJSayk3R1JgrH6qPlhf/peSF0IGpElfhTwbjrldBSfxjHYkm5sOA0yUaSyywhkjMihkGdRWim7L05kGo2vDaYYaRhSyaaDXGokLYxh8oo2E548Ct75KcjRBzr54fT7gqhAsViWJEpxFlyVXfIzg5HNinqDLdSrUp97+Qwe3oegmwU5Kv6GJ16TMufGjGvh8FhFPi5aRUzCpxviN5/j29YTNN3NQGm/RXPobhqQQFuQY3zZjGyP2V4To93OlBQEgRgN6lNt4GzNiY6LQz37QHOPriEOu6RX6iNxQGir3LPNmp34iFXuuwJZ98E/yNnnKm8pbUZopHZqwZP1rQciLx9pLW4HQRViptSJR1Js+cwlPXjhbViLeIeIbPGq7jLtBjMMZOvY4pISpRyAjDLIUrAgae+OtFT5TZAjUzoMREGnVKJNxJ/vk/ynaHZFcpc+3Jsu6V4FIYlTONTpgf9VnpvDgwfW+kxDl6kshbrvyoGvTu5tinfViS3a+pqBWubHyWSghjt3p2iuYJkmdYBjDEWnLgBByURMpVzmh/oC7yJ9lMZSwfdbcrepE1MqwlH0S11yu1dZlJ7LEcdi5aIVYmtWtow8gEj6d1QN4+PsOAdmoe3mkjg/cRC8Iwqlx6KTIsE1AFpa+O+jOJODE+PV99nf/1vjxB2Llie0m/90qo8oakPTUlftq+glbYSEEHjGSQ= 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:(13230031)(4636009)(39860400002)(376002)(136003)(346002)(396003)(82310400011)(186009)(1800799009)(451199024)(46966006)(36840700001)(40470700004)(6666004)(7696005)(83380400001)(966005)(478600001)(336012)(426003)(26005)(16526019)(2906002)(7416002)(54906003)(70586007)(2616005)(316002)(41300700001)(110136005)(70206006)(5660300002)(4326008)(8936002)(8676002)(40460700003)(36756003)(40480700001)(356005)(36860700001)(47076005)(81166007)(82740400003)(2101003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2023 06:07:26.1707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84d78275-2e4f-4253-3882-08dba85637f2 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: SN1PEPF0002636E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8798 X-Rspamd-Queue-Id: 01321C0012 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: gs6foosc6gnxo399a5k3d9z6kmquxxo4 X-HE-Tag: 1693289252-791828 X-HE-Meta: U2FsdGVkX195KGx3cDJZTu3jBxEwZAVedY3plobt8F5pHaGYvhNIqQiRPOC00pr6ut3vzTBdc94SJZc1KKMROK6qoEqYhQ7LWMIjtrtKEs64UKMprd4PdDCP391DvPxUzw04O48weaiwYf5Txr1/HY0L1P44uneyyICzvK6u9i5wcKRqegCkTFvv0UDijLGmUV9moY2jEvRpT9eaizkiaffj1rb6+MjppZ9b+3z2vvPCNXnX86dd6Joa34UblYRvdk2apOH6vf1fi3G115H1x14kJOG9vh15uFPlLUwN487P5XEWG9tBZt9nWwHTR8V6ep9v4tzGcl32mKdglvg1Q6oQ8tHaclbHpGye04M7oVUAER0v3OXcjAp8efMYVeQEDVF9OdXWOpGqpAKmIr4RlBmsUSZC8P+ja2IcXzoXziEZqP6DMytKU+IeBB4fqcHYJxAJ+cBaTOLS10eRFz7A+OHOEFawXrZ6LFEIVAt4a0ryC4PVdUf6fjc1wqZ1jg5i+PdZ+oNhEGtF2UR3cpAgek2Bu1IwH8nFRPgNud+h5Wpwvgqi9CgXr2pbUSLVObbDoMJ7qqLtuWi1opQJ7PaZdWR+DTjpXjT+FQwX/Raea8xUuBHNf+bKMJHFAJz4QPCvnODCb8CxB1jQcBUO43ocyrVpFuFLZJ4p2TNLwohfx/qvLnM45rTo9Tex+pgkthK3I14kq/c8dltyvCL3CkbPzMkAISZD7I/nm91u2i9zEnfquN6CD9eKZ03TJM0+77Sc5RiWe+VoX6ljR3BU/XiQsxNnWLaPsVJ5DiiCNW/SWjXd0koskmsBKwIaRLlCz6OLDArjTBOqsrKHauRIRVwKDEk+tlHpGusNRx/+VeBzxMHATtnEeBE+fZAkmlbClnilfjsYztqL1tjX6iXYqxl0sLceTehhmf5TyL4EfvLYsp8qp/vTdyhAgViHbMXxNKjrWyrmND0DrtYSLcd6VIx +t/b24gD 0eLqTA5zSnt5JYFtE/ReS36hK3xzAqHbWfg0LQ0Sc+S+ZQURxhfC7fqopdZ4+xKkU2b3TvJQVV6sdsR+EsQumy0rGw9+HQHrlcq+542CPT59E49s+WHJk/JFZSs3TEtgf7XTOjaCFMqnw+Rf4KSP+Uoeb93N3DuxOyVWRYyEJy+0rqYZZp9GpuCNcDxqjYp9BNQfEyiqJDrymxQOZnVu4pnfBh2l6b+00NWHz7N1yGv5QVfybJOblIin1vfxPfUjMsjda30HjlCTlt5mDbt1lZbOJtXBdPKN8GVk9kQMTffNYljsFLRRlnQRMqSgEgwesGpXSHNDkDU3P+uafPWqQfGz44hZrN5g8vPCVjU3D5HdqfSobqgPu5SDiaNXzGlCpHTVgJ0VXSYSRwf0xEZAHtMwo0THiClfYTR4BmN+c6GwVWrX9B4qtyKKUlWCrvz44BYJR3FQ9aAkim1b4Jvgk79aVkqlaUEwG1zluT4aId1NV79fOlqQASjdRLnA1/hzbESrYc9xHBwipoLJF1OvRvd9GrhTPWblMP9QOiul5odc19Zgbg3U28UdtVfPcHUAsvAno8GVxG1n8rhimLQWPoyGuC8l4YA4VTKUuC8dG0NUn5tf6lDJ6A/55gWlaTyBmzHYAD9qqt1BitZI= 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: Since commit fc137c0ddab2 ("sched/numa: enhance vma scanning logic") VMA scanning is allowed if: 1) The task had accessed the VMA. Rationale: Reduce overhead for the tasks that had not touched VMA. Also filter out unnecessary scanning. 2) Early phase of the VMA scan where mm->numa_scan_seq is less than 2. Rationale: Understanding initial characteristics of VMAs and also prevent VMA scanning unfairness. While that works for most of the times to reduce scanning overhead, there are some corner cases associated with it. Problem statement (Disjoint VMA set): ====================================== Let's look at some of the corner cases with a below example of tasks and their access pattern. Consider N tasks (threads) of a process. Set1 tasks accessing vma_x (group of VMAs) Set2 tasks accessing vma_y (group of VMAs) Set1 Set2 ------------------- -------------------- | task_1..task_n/2 | | task_n/2+1..task_n | ------------------- -------------------- | | V V ------------------- -------------------- | vma_x | | vma_y | ------------------- -------------------- Corner cases: (a) Out of N tasks, not all of them gets fair opportunity to scan. (PeterZ). suppose Set1 tasks gets more opportunity to scan (May be because of the activity pattern of tasks or other reasons in current design) in the above example, then vma_x gets scanned more number of times than vma_y. some experiment is also done here which illustrates this unfairness: Link: https://lore.kernel.org/lkml/c730dee0-a711-8a8e-3eb1-1bfdd21e6add@amd.com/ (b) Sizes of vmas can differ. Suppose size of vma_y is far greater than the size of vma_x, then a bigger portion of vma_y can potentially be left unscanned since scanning is bounded by scan_size of 256MB (default) for each iteration. (c) Highly active threads trap a few VMAs frequently, and some of the VMAs not accessed for long time can potentially get starved of scanning indefinitely (Mel). There is a possibility of lack of enough hints/details about VMAs if it is needed later for migration. (d) Allocation of memory in some specific manner (Mel). One example could be, Suppose a main thread allocates memory and it is not active. When other threads tries to act upon it, they may not have much hints about it, if the corresponding VMA was not scanned. (e) VMAs that are created after two full scans of mm (mm->numa_scan_seq > 2) will never get scanned. (Observed rarely but very much possible depending on workload behaviour). Above this, a combination of some of the above (e.g., (a) and (b)) can potentially amplifyi/worsen the side effect. Current patch tries to address the above issues by enhancing unconditional VMA scanning logic. High level idea: Depending on vma_size, populate a per vma_scan_select value, decrement it and when it hits zero do force scan (Mel). vma_scan_select value is again repopulated when it hits zero. Results: ====== Base: 6.5.0-rc6+ (4853c74bd7ab) SUT: Milan w/ 2 numa nodes 256 cpus mmtest numa01_THREAD_ALLOC manual run: base patched real 1m22.758s 1m9.200s user 249m49.540s 229m30.039s sys 0m25.040s 3m10.451s numa_pte_updates 6985 1573363 numa_hint_faults 2705 1022623 numa_hint_faults_local 2279 389633 numa_pages_migrated 426 632990 Reported-by: Aithal Srikanth Reported-by: kernel test robot Suggested-by: Mel Gorman Signed-off-by: Raghavendra K T --- include/linux/mm_types.h | 1 + kernel/sched/fair.c | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 5e74ce4a28cd..647d9fc5da8d 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -479,6 +479,7 @@ struct vma_numab_state { unsigned long next_scan; unsigned long next_pid_reset; unsigned long access_pids[2]; + unsigned long vma_scan_select; }; /* diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2f2e1568c1d4..23375c10f36e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2928,6 +2928,36 @@ static void reset_ptenuma_scan(struct task_struct *p) p->mm->numa_scan_offset = 0; } +#define VMA_4M (1U << 22) +#define VMA_RATELIMIT_SCALEDOWN_F 7 + +static inline unsigned int vma_scan_ratelimit(struct vm_area_struct *vma) +{ + unsigned int vma_size, ratelimit = 0; + + /* + * Rate limit the scanning of VMA based on the size. + * vma_size > 4M allow 1 in 2 times. + * vma_size = 4k allow 1 in 9 times. + * 4k < vma_size < 4M scale between 2 and 9 + */ + vma_size = (vma->vm_end - vma->vm_start); + if (vma_size) + ratelimit = (VMA_4M / vma_size) >> VMA_RATELIMIT_SCALEDOWN_F; + return 1 + ratelimit; +} + +static bool task_disjoint_vma_select(struct vm_area_struct *vma) +{ + if (vma->numab_state->vma_scan_select > 0) { + vma->numab_state->vma_scan_select--; + return false; + } else + vma->numab_state->vma_scan_select = vma_scan_ratelimit(vma); + + return true; +} + static bool vma_is_accessed(struct vm_area_struct *vma) { unsigned long pids; @@ -3058,6 +3088,8 @@ static void task_numa_work(struct callback_head *work) /* Reset happens after 4 times scan delay of scan start */ vma->numab_state->next_pid_reset = vma->numab_state->next_scan + msecs_to_jiffies(VMA_PID_RESET_PERIOD); + + vma->numab_state->vma_scan_select = 0; } /* @@ -3077,8 +3109,11 @@ static void task_numa_work(struct callback_head *work) vma->numab_state->access_pids[1] = 0; } - /* Do not scan the VMA if task has not accessed */ - if (!vma_is_accessed(vma)) + /* + * Do not scan the VMA if task has not accessed OR it is still + an unlucky disjoint vma. + */ + if (!(vma_is_accessed(vma) || task_disjoint_vma_select(vma))) continue; do { From patchwork Tue Aug 29 06:06:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 13368615 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 9FE06C71153 for ; Tue, 29 Aug 2023 06:07:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1FE7C280033; Tue, 29 Aug 2023 02:07:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AE918E001E; Tue, 29 Aug 2023 02:07:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0771F280033; Tue, 29 Aug 2023 02:07:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EA6DE8E001E for ; Tue, 29 Aug 2023 02:07:39 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C236F403C1 for ; Tue, 29 Aug 2023 06:07:39 +0000 (UTC) X-FDA: 81176110638.09.EA44415 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2051.outbound.protection.outlook.com [40.107.94.51]) by imf26.hostedemail.com (Postfix) with ESMTP id C6DF514000A for ; Tue, 29 Aug 2023 06:07:36 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=tkW9dUVT; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf26.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.94.51 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1693289256; a=rsa-sha256; cv=pass; b=Tzgw6mz8vdVK2ebwXvKzCwILBQzUbL9qf/qg5ps1X1ChpFxbITmzKPClrNE+GksYaPs0W/ wNpC6nhmF1Ao/uTItSoTvErjSi3nQdIathEol4WF3f+Q0iDJZcMGeIMRWfe6rufWPO/yZB ol968faxu1nN4pmsjZNpPZH6eg72Jwk= ARC-Authentication-Results: i=2; imf26.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=tkW9dUVT; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf26.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.94.51 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693289256; 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=IEz2+qnb2lnDS8E0XPihouWAu39teWcxGama3d/HlJE=; b=FU6T04/QHvhxNBpeFcOiEriJEOJa7w1QC0qUDzDylsOXxWSIbGgoS+XhzMHytjs1s3FFba bevwrTB5OMrV/Rzsp/FUTPNsKvofiZPVXjjfxJL+m6+lC4VDoxhcz7qLqr9AnoJnNMQauU L7Ne6ofL+fJePZ4gi0d3lowYGh3C3KM= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RwHuH8lyZfIOX6uy7ysdaOXTGDbzRyqIB83ajCb7KXIXNrneL0OLaxKhQujkp/51EDkqgddCScSbSWBfK7IFprIiVaZBwP8PdmfhvoMJhevlCfFKOYaRi3AolzZNXsMnjvxL+pCwDDL5C1wnpm9qJinxYOmzC1X7JoYwYExSSXKWFxvYEGofkBJOe7YIHTDdkV17wA/Eym5pmdMYNtLRdq+pApHLT4TmdDQWL0NaKliTfD8G07EnRCrvRrf5FHMeWOMEyaDAs4+ttLFxD4C57V3/+3A7Z6Ui+Y1lBP2KiCNTKQKHh50B/nQu2FTOgYnv+24mDYHOBKcbjFM2EIM/pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=IEz2+qnb2lnDS8E0XPihouWAu39teWcxGama3d/HlJE=; b=kPXzkXkjO002wBOXnTc7YcXZCBjDfuRKJhig9cOREZyAufaKO5EtSd0HaoJx6xUjxYCXOsGjcGfUcGXCv5GB2yphJF4AhW8cOulCh6e8+mBqNbXScqeHl40bcb+nKb0hQjiY6w3kpIdHnwn2RcftXOJON56uvew5fXOMAPxzPoXPfHsHBzqpjskWBujcX7HWC4ggoHSzxpjCEfX30jzEgNb2mM0BTiJkRkIRSITCQoPa3825U8feRAucQloW2Vwbx22wSNcDDzBlaeDLtitjMbyj9MccU9b9BCNW4VRL9rhWzqivtsDolrqaDH5GQsbpIoIAOUIxH8hzFzjeQCheeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.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 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=IEz2+qnb2lnDS8E0XPihouWAu39teWcxGama3d/HlJE=; b=tkW9dUVTnH0my/7jP+6xVW4V+kb+Hm4cgN0uCZ/8VsuUzrQevXbAJjbvI/GvpzHL2TJjIE1relN0rj3xCxpVkhzxvvme/kTqzWh/S9oNh/OIMLPUGOzFFMa1u0H7vo0fMe3dpjzPDi8XSJLu6X5yz5pzVxNqsQCEyVZIAM+Oh7A= Received: from SA9PR13CA0068.namprd13.prod.outlook.com (2603:10b6:806:23::13) by CH3PR12MB9218.namprd12.prod.outlook.com (2603:10b6:610:19f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35; Tue, 29 Aug 2023 06:07:32 +0000 Received: from SN1PEPF0002636C.namprd02.prod.outlook.com (2603:10b6:806:23:cafe::dc) by SA9PR13CA0068.outlook.office365.com (2603:10b6:806:23::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.18 via Frontend Transport; Tue, 29 Aug 2023 06:07:31 +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 SN1PEPF0002636C.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Tue, 29 Aug 2023 06:07:31 +0000 Received: from BLR-L-RKODSARA.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.27; Tue, 29 Aug 2023 01:07:25 -0500 From: Raghavendra K T To: , CC: Ingo Molnar , Peter Zijlstra , "Mel Gorman" , Andrew Morton , "David Hildenbrand" , , Juri Lelli , Vincent Guittot , Bharata B Rao , Aithal Srikanth , "kernel test robot" , Raghavendra K T , Sapkal Swapnil , K Prateek Nayak Subject: [RFC PATCH V1 3/6] sched/numa: Remove unconditional scan logic using mm numa_scan_seq Date: Tue, 29 Aug 2023 11:36:11 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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: SN1PEPF0002636C:EE_|CH3PR12MB9218:EE_ X-MS-Office365-Filtering-Correlation-Id: c9faf779-1997-45ca-7613-08dba8563b05 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k5biHmpdEDFVYJgo4N2fAack4i0ZOMS63ZDUR1Oz7VOZCfNH+6Ovd6rHzwxtuWEJRttFftScKA5O1e5wTjSmxqifBpST70AAii05B+Cp5KgSDLMu9xWuEYzTTwpn8vaSoUDQIGBKa7axdMTmo1Q4OoocJFVBSzKnCxhZ2ukRpOi4FlB5sOobvKoGhO/mzPCGBSMyTUy9ttX1PG1rFywNBTnP4JW5o53Yew7VGiQX/9wR8Rrx95ArDLPiegy2hpBDOpt9qsjKTL0hawrvleGe715yFiKbDu7T4ZXt9sEsIzuCa11RCjI+YWd80kzfIxBu4mYUKxS2FOM1LcKvFJx1Sf38YsQS7J8izYsGEEaVlgMS5ddAZjnkvNsY4yoBnBq+Jtctbhsv/di/WysEE4OHwDXv760rmVAL2MUe5NIr4usHPK9NplOF6wo8p3tn2JyLGdgxCTo6lDQl6Q0J4J3ePrhY2agwOjCZdF0M/YuV5c+1WVsQC+JpTiFVI9n54EVXWXTM6MjxIMKuV+C2a6FGtxpCRP7hdJZU8e7MOnq6l9HefgnaU96ZjzLRNloIBx+eRjTt6MyVK4VT9/0+iyuGm1xDaiaCUmPNzQoeb/xu8uKTfI9M6/KkTIU6KDDCv/ajvnFW744WO3c1sh6UIycj66k1armCNf48jDdEKgXMqtgsj87+2BfGxSKMzo1CBUGm1fg83ZUhb0nTrWoCWlwlbKX8bo+rebX/sB6FiikcgrGLN5lRkteo9c850Zvlj12Z4GNA/aTtmyY0Vb9RovpMsTPuP+EqXlO7uKlDBFbmzHE= 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:(13230031)(4636009)(39860400002)(136003)(376002)(396003)(346002)(82310400011)(186009)(451199024)(1800799009)(40470700004)(36840700001)(46966006)(6666004)(7696005)(478600001)(83380400001)(426003)(336012)(16526019)(26005)(2906002)(7416002)(54906003)(2616005)(316002)(70206006)(110136005)(41300700001)(70586007)(8936002)(5660300002)(8676002)(4326008)(40460700003)(36756003)(40480700001)(47076005)(36860700001)(81166007)(356005)(82740400003)(36900700001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2023 06:07:31.3455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9faf779-1997-45ca-7613-08dba8563b05 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: SN1PEPF0002636C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9218 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C6DF514000A X-Stat-Signature: ysg1rroa5qj3134o9beuc35idw5dz5k3 X-HE-Tag: 1693289256-479453 X-HE-Meta: U2FsdGVkX1+K64wluRVlQqUZSbkl01XAnKL5bpEE3JDUU2h08SH79T9YJW+JW4b2s4Pr1WM7Aj1KXha3a808eEbnxlXuwYBk23QjKHe0dS8cb7YdacZVXMv/hM/AwE2mvMKaV3i8o9YzgVAsBGG9+tnkApXsTqj9IyavsII81YNKqs9luh66L9ttx2A9On0537wNSyfqxN8FFMeZwrh4+vxI8zckfSMk1oK9s8lrkDBxwfiy/c9UHEAV2QuhMGZbAbxqUSbw077HieWWm4ZyTiFfzn43HMO4FWeBXz+H5K+TuZszUbFtao11Xu8saJndDuffoX1ky0DMWC1DNm7PPYkdlc7wpZmUX0xe3mL8jWRZnENC4YAJbAqGoB3PsOkvCS+NoBkX1AqbV1VdY4FKyqDQckU1B1bYK1jQyNHTvNT4JB/djYh5X7sqzLi0R9fT2ld85+y6qkjxb9eLtbtnd0KucXr5Sba1LpxjAdS8vRHbNtDkc18EdOcoh18CdkYVTEZjcNTC+D1IP6822FLCXf/viRnix3hmS05cKoC6SN2lrcx0Ydt/7JoZZ+IIcTFM9nMf/uflgbHriPJskMUyRTqpgWYp/Uujp4XAi8V5jGsSgYTBWPVdrQ6W0OqgEAWu0DMpGOul2vsuEQjQ3rpS53fdf+E8A5e1DSpHdDUM7NgZp15kqVHIZ/vdGJ98dCy7xEH9uYLdDR0tnkOP6BBbOdJwzsCxmQWUgGCHs/8mqgTCJHhaHoWqN0kNxo8mb2VE8vOd0SOdT8ItKTBoUr8UCLWJtyu85n7KzHEjKqsY/jXIHiggNsnxKVqNgtVptpxy7dm8hMqpJ2ah0hFuYSRCy44+FTjRkh3SYRVyYCIK2VQHjbVZk+dSLMJsrwbjdOIBhp9xYeCKKg+RJaxmj8IzYJlf58iTgIbcwsowu4j12vqJeekKqp1d0BtAAdv762C+yhnMxuR47EaUlWZbsOn TDsE3V8Q Y43iMxqStJ/yEJqzOBYmjIU/gG954U0W/kLFq/II74+9eg+sUW8IGtuA5JbqwXlXQwym8EAeZjuY00q4KNOH7trgoQUTzeHGJiKGd7A80OiJZrC7Za0V/gq4ptzYqJ//34f0wgJLVB7k8ulbpVqtCmUgyYaYeKNDniD2/gc1HtxyjsaSwNyQO8Q5YvmmnEvgPqJuA1eLMF2mn5azTKzZEWt876Vn+jzBrGBvigLGaNsyKwxCMJ9QpBqNC7cBI+lAnbm8R1uBVCDQPv/B/T094s9WLb+5/d6a6U27lOqENVVD5JfdcSTOa1OdssDH/IlHwqECN680VSsJeFm4h8zmksr6hYEwqat4Cx9gP0SByr/Y+wIkownmkxI9VWO+1RajeytKgUwKufvoMfa7GKvUQhJFmezkcIvaorjjOzsa0XcfjoEo6v0N3Uabk1D55EIGSMwmOmu5Hvbx9Z3F7YRVnaxzjcd1FVL5YFOlotT8CcRcpVmYZeiLureGItGnvIOVMzTfS5vNborWyW1vEibMCgYR1bWG+DcEO8yKTislV2GgVdoY= 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: It is now redundant after unconditional scans introduced for tasks' disjoint VMAs. Also this approach was not considering a rare case where a VMA gets created after mm numa_scan_seq is greater than two. Signed-off-by: Raghavendra K T --- kernel/sched/fair.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 23375c10f36e..e26e847a8e26 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2961,14 +2961,6 @@ static bool task_disjoint_vma_select(struct vm_area_struct *vma) static bool vma_is_accessed(struct vm_area_struct *vma) { unsigned long pids; - /* - * Allow unconditional access first two times, so that all the (pages) - * of VMAs get prot_none fault introduced irrespective of accesses. - * This is also done to avoid any side effect of task scanning - * amplifying the unfairness of disjoint set of VMAs' access. - */ - if (READ_ONCE(current->mm->numa_scan_seq) < 2) - return true; pids = vma->numab_state->access_pids[0] | vma->numab_state->access_pids[1]; return test_bit(hash_32(current->pid, ilog2(BITS_PER_LONG)), &pids); From patchwork Tue Aug 29 06:06:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 13368616 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 83E46C71153 for ; Tue, 29 Aug 2023 06:07:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11432280035; Tue, 29 Aug 2023 02:07:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C57A8E001E; Tue, 29 Aug 2023 02:07:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E59D8280035; Tue, 29 Aug 2023 02:07:42 -0400 (EDT) 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 D15B88E001E for ; Tue, 29 Aug 2023 02:07:42 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8E56A12042F for ; Tue, 29 Aug 2023 06:07:42 +0000 (UTC) X-FDA: 81176110764.04.5B701C7 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2047.outbound.protection.outlook.com [40.107.243.47]) by imf01.hostedemail.com (Postfix) with ESMTP id A7B3C40020 for ; Tue, 29 Aug 2023 06:07:39 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=I+hzyMqD; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf01.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.243.47 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693289259; 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=9iOx8gTc3LVF93/VuEpUYYY6Fy2SDNkAdxbQ7DX8kM4=; b=hBPbwNj07SBk17SWVt7K7Hz4YmqOSOiHxLXdZFdeYVfDqGwl1/qcNoZDxR0KqVaDRVhKAJ 93gUxwIRoGVnKaXRNSqddotEmG22lW6l7+/ZkjrlgCXc6diizqQ+mrjf8zf7e+42sp74o3 rzwSQrJ5NYHUz8c4i6+SBmj2nz5JGjA= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=I+hzyMqD; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf01.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.243.47 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1693289259; a=rsa-sha256; cv=pass; b=DpXyziKeqBuLD/SUAuJHyYcg5anNJmVgNKbdUk99IDBxR39fZJf8xuFYB4agB5zSQfT/5X 1Ew5vnTNMTqISaoJarmjQ/ItH2Jho1vsfVeX32CwJuLSCbntzJzefsI0U0qEvsmD/rUmya tnKms/J2bffWBdNokZ84DkGsKykzr3s= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BAOiNNLWGyleLNWJJDXS3p2/6HD4eocIA4UNvYWXxveSFHPgpBL/8vrZEfrJvxDqYKUCch8woOM9n9K7feMaamFaiVvL/BL7bRecxtwitWM4e7Xd0NjE3tZ2DzJI79l42JUVbnDKI/Kru3zOwFyCflmRWAN9/d5Ip8FNggSTJcWMA/3/QyABV/n4vmgw9C0j7TZ1usJ4Ep1btnJkt8aW76jp5yQxrHBWzWbqZMUjcEJlJ1QhuL88aVSzYFyngmHMcOvymNNemJFJb2k1rsC9dHv95Tsf2um1gfgxTiwRefIPd+3xMz7RiVF6elQBbaRwSeBrjpsb50D8AxzpPlpT6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=9iOx8gTc3LVF93/VuEpUYYY6Fy2SDNkAdxbQ7DX8kM4=; b=GfYF3E2tmBT4ISMKsuKeAJJ/sJ657zv/M/GElu3e2Z5SSGwhRYHOJYzuzyBbAIve3k6RLGkaf5EelrfUse2dxs0T8srtIaRkJttyhTHVd6VQsCrEKE//rYMPQvMZLCksdD9Idf7i3j8R0pP8Tm4gsIJhdCdnmnQyZCkQjWT5rSUh2vFIRK0+qvZU1DFSrFLiYvT7bLLphPND2Fs/dVvS5VCud3/GQUJtTIUE/+57GYTlvUwymMcJJjxOOKZm/yi9JXSswKHVfvhPA+D8zzdUJRnVJ5qA6+HmRayI+Z84JztjOl8MnFg3tSrLHsOmXYxpHEL3hzBFuMJEr0GxIlXt/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.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 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=9iOx8gTc3LVF93/VuEpUYYY6Fy2SDNkAdxbQ7DX8kM4=; b=I+hzyMqDNxeglC+xskhC0Q419Nv07Bsas0yQXEniIauKMLlm5J31N9APHICHpMMJN6AxYCedU4Zf3vKHwUsQHpHC9hAnIiClVF6MrhzYeDc7kHArPrlnDSvQoh8YvocxgGFh568LvRDY2zLEZcTuegm1QCwB0ClL1dGtEXEbM/k= Received: from SA0PR11CA0157.namprd11.prod.outlook.com (2603:10b6:806:1bb::12) by PH8PR12MB7134.namprd12.prod.outlook.com (2603:10b6:510:22d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34; Tue, 29 Aug 2023 06:07:37 +0000 Received: from SN1PEPF0002636A.namprd02.prod.outlook.com (2603:10b6:806:1bb:cafe::44) by SA0PR11CA0157.outlook.office365.com (2603:10b6:806:1bb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35 via Frontend Transport; Tue, 29 Aug 2023 06:07:37 +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 SN1PEPF0002636A.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Tue, 29 Aug 2023 06:07:36 +0000 Received: from BLR-L-RKODSARA.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.27; Tue, 29 Aug 2023 01:07:31 -0500 From: Raghavendra K T To: , CC: Ingo Molnar , Peter Zijlstra , "Mel Gorman" , Andrew Morton , "David Hildenbrand" , , Juri Lelli , Vincent Guittot , Bharata B Rao , Aithal Srikanth , "kernel test robot" , Raghavendra K T , Sapkal Swapnil , K Prateek Nayak Subject: [RFC PATCH V1 4/6] sched/numa: Increase tasks' access history Date: Tue, 29 Aug 2023 11:36:12 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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: SN1PEPF0002636A:EE_|PH8PR12MB7134:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d40630d-9702-4a44-e3fd-08dba8563e61 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o26tZ2K2wPyu5XQPs6GIN712exnTqXPHVdz8k+Q06SMahzFmB38S4lZNlOizRryoD2cMWd69QxOJJPzWKMCcVTSLJxAukEc4qs4N9jTGNic50eBPeYxl17R9zphhQZF5iXy50ipzqm078ZTKq83i1Ua/bP244smTXuBH7s3039wUDMvj4+0pp9BUad9s3ZyR4mFnkuOflPk+VQLSFwOi6rEZN/pyymZM56cSyzR6tIVmVZpod97x0QYPPhN3eCZtSM+sbtOZngtdlkDAlKVlaMPofeZNhRkhxMefjdj/u+GwBtLe38BtSCZCdPjHoFz0LoeXQBUp4CYEN1kDbGmshbnlJxUbapPPX+lKvizATeB+fGkSaUUkDlon1b8+/WxD9XykqWZTrfX3FBS1ZC5TYxBT6jnUxsUkKUesyAPn/6R8zAwoIIfC5CqlPsDTeCUKkX/N5IiJF+Ya7RTLjuPC191svbBvmU/h6KfYpIvLSLnRRNKn1a6nDaX2d1pZBJu4F+MYaHO80qVEOHQ8DvKKa9nUM92HPvRmxv0dq51rnrDvQnfiMcGEaEh1NU9f7qwMrUCI3nz1ZoQgLOidy8X0SlKJPBkhVKphFwoY87AU8TgHtF/s5HhqkQdQpkSK2b53tzFQamzJTMInIOPGDupM8J7HEuTWTxMx/SvcfmYYIgLiojiW+66HqN/67mNihShNFE3i1h+v2Ub1iULYP3luQ6pmX+vY/vsiPVCuDUSZyqZotwkabvv11SyHvU272tfVw44TVFQ2R1a0ZxGxMoS7R+R0x2nz0q8aANFiWaoy1CI= 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:(13230031)(4636009)(346002)(39860400002)(396003)(376002)(136003)(1800799009)(451199024)(82310400011)(186009)(40470700004)(36840700001)(46966006)(8676002)(8936002)(4326008)(54906003)(110136005)(36756003)(316002)(70206006)(70586007)(5660300002)(2906002)(7416002)(336012)(40460700003)(41300700001)(36860700001)(7696005)(2616005)(426003)(16526019)(26005)(40480700001)(81166007)(82740400003)(356005)(478600001)(83380400001)(6666004)(47076005)(36900700001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2023 06:07:36.9532 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d40630d-9702-4a44-e3fd-08dba8563e61 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: SN1PEPF0002636A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7134 X-Rspam-User: X-Stat-Signature: yd8msuhioodkni1im8uh6g7aryc61pzb X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A7B3C40020 X-HE-Tag: 1693289259-136590 X-HE-Meta: U2FsdGVkX1/DbN7MzXqqZMhgzcrCfHgbqUl2mDoHSKfgGvmNBNLsf6+SPScBxUxQ7fKaCxNhQa3+sTBexiUeVLfjEKeUpgV/Ra7kOCrQwsGl76pakreuD/SGmcJKZnh5D95/6zq1MADAxxjVM4Mp5or5QlCGWhRBnebkWfwKS2y+aUqQ42dB8+/moRBfCCCRVM5NX3hTj1V2W1K3qfyuR9te7mrHVn0b+nx2niJd9i0xlqJd7SnQBRPiLURWK3jmO8OXn4FZjhvSc1PW8FdOGX2PT+tpYBCLcqhKYV7JqyrbP9REhSl2OSDD/toWZQ+JrpL65rWEWaF9KH5aLHDCDKdDr3ByMgpeClNMunw+hzLQ3+y9OuyD84PaszpLoB8z3vNUhfxCrvys9hb6NMyE/YoigWbFKeJ9aIT0SlSg1Y2ed8iTb00dQbsc0Mw+QrNXzOnprcEt7NG8lM1vZsVPg7b8uGpKMjgJ2XGURwIn7yyJX7mRJ3e/7B9d+8Oqp+Uaui8l4b0tGIBXmniALAWLiJOqb4s1CJFPHWHqfmgvwjLD7+hZzmYh4ckGNUdYkDO/kFcci1+07PukgrHazTkNtF3LxhbbCvQzSwg7cw6FbdZL+Cc4WY0iCiNkjsf6bSgWiJCtCtmO9JhVanVPFHL22TDUMcZGusa+ZAinuDyb0Q5KZgrc+wC7z0mhAlbmLK9Y46D+zNWBDSZZeYxeXA8w53fskGQAA7NIDYt+UQuh4UGVfCc8qxpiPk53JsQ263hMmsWhYYTz6y8in/rFyIRAifnqwPp8912yZlN9Kdva95nt1ElKDM4T5ih7nDU6FbwBCwdkwkgrbsDmES4uua3w6dsMKagqemYGZ6nrqx7fyNChGF3CcYl9bj1tq6NE7wzlxXB637+KBOlvzgKXQCJPHx1clME2Wsp9gJYeITKvg23nYi1yDN0UXyoTpEVis1TmgPJ6c/PYVmDIDBW6O37 alVINALj RkhGyYaUxiREVWDXDXcaVsxRMJN7iiO3x0vSseAPr2UkYCFACYdt+7z5SQGX9IgRvIX5bBiDK4owN0bvLg2RupAy/DsLL7FJ0efUHlJvugs0fCCfxygL5h4Ud4Y+kikRf/nVvCD1Z5RdZEg0QX/9qnUTVQSUKpYjbsGrFJU+BcWRzri4A1UUkEdd6qWL53a/EmgZVDKfBNU3BvFiCV1cRDXZIyFxxNXCsW99ntiDK6cpjpwdP+fu540m9ZUPQ9HIKrRsZbaPfzuiwD8SfKmeg7ilaYtVV0KUT53D4ku3eeOVbPEY061qjU3m+jqzpjHF/KkSbf7hToEW1OliJqG1LDMdXpHb/5hLEtl1J5sWZ44HCjY4HeeWRCTBxTMH5k8fJgeiaTwDphTqVzbU+CNQhPu8aXO6n15eDamEs239MV29k3cfW1/Xp7ybgZi85AcsYH8svViIbZ5XsEWEdm9qSgVJ3yjO/304xRSn30b2mmoLEPqmilzCxQB4Y4DGiI5WT4T+dRjBu29GKi4hV2V/vJXNffVtXR31c7xRlpsWC/kAYlUetlTQorWVAkA== 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: From: Peter Zijlstra from two to four. This prepares for optimizations based on tasks' VMA access history. Signed-off-by: Peter Zijlstra Signed-off-by: Raghavendra K T Tested-by: kernel test robot --- include/linux/mm.h | 12 ++++++++---- include/linux/mm_types.h | 4 +++- kernel/sched/fair.c | 29 ++++++++++++++++++++++++----- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 406ab9ea818f..7794dc91c50f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1689,10 +1689,14 @@ static inline int xchg_page_access_time(struct page *page, int time) static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) { unsigned int pid_bit; - - pid_bit = hash_32(current->pid, ilog2(BITS_PER_LONG)); - if (vma->numab_state && !test_bit(pid_bit, &vma->numab_state->access_pids[1])) { - __set_bit(pid_bit, &vma->numab_state->access_pids[1]); + unsigned long *pids, pid_idx; + + if (vma->numab_state) { + pid_bit = hash_32(current->pid, ilog2(BITS_PER_LONG)); + pid_idx = READ_ONCE(vma->numab_state->access_pid_idx); + pids = vma->numab_state->access_pids + pid_idx; + if (!test_bit(pid_bit, pids)) + __set_bit(pid_bit, pids); } } #else /* !CONFIG_NUMA_BALANCING */ diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 647d9fc5da8d..676afa9e497c 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -475,10 +475,12 @@ struct vma_lock { struct rw_semaphore lock; }; +#define NR_ACCESS_PID_HIST 4 struct vma_numab_state { unsigned long next_scan; unsigned long next_pid_reset; - unsigned long access_pids[2]; + unsigned long access_pids[NR_ACCESS_PID_HIST]; + unsigned long access_pid_idx; unsigned long vma_scan_select; }; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e26e847a8e26..3ae2a1a3ef5c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2958,12 +2958,26 @@ static bool task_disjoint_vma_select(struct vm_area_struct *vma) return true; } +static inline bool vma_test_access_pid_history(struct vm_area_struct *vma) +{ + unsigned int i, pid_bit; + unsigned long pids = 0; + + pid_bit = hash_32(current->pid, ilog2(BITS_PER_LONG)); + + for (i = 0; i < NR_ACCESS_PID_HIST; i++) + pids |= vma->numab_state->access_pids[i]; + + return test_bit(pid_bit, &pids); +} + static bool vma_is_accessed(struct vm_area_struct *vma) { - unsigned long pids; + /* Check if the current task had historically accessed VMA. */ + if (vma_test_access_pid_history(vma)) + return true; - pids = vma->numab_state->access_pids[0] | vma->numab_state->access_pids[1]; - return test_bit(hash_32(current->pid, ilog2(BITS_PER_LONG)), &pids); + return false; } #define VMA_PID_RESET_PERIOD (4 * sysctl_numa_balancing_scan_delay) @@ -2983,6 +2997,7 @@ static void task_numa_work(struct callback_head *work) unsigned long nr_pte_updates = 0; long pages, virtpages; struct vma_iterator vmi; + unsigned long pid_idx; SCHED_WARN_ON(p != container_of(work, struct task_struct, numa_work)); @@ -3097,8 +3112,12 @@ static void task_numa_work(struct callback_head *work) time_after(jiffies, vma->numab_state->next_pid_reset)) { vma->numab_state->next_pid_reset = vma->numab_state->next_pid_reset + msecs_to_jiffies(VMA_PID_RESET_PERIOD); - vma->numab_state->access_pids[0] = READ_ONCE(vma->numab_state->access_pids[1]); - vma->numab_state->access_pids[1] = 0; + + pid_idx = vma->numab_state->access_pid_idx; + pid_idx = (pid_idx + 1) % NR_ACCESS_PID_HIST; + + vma->numab_state->access_pid_idx = pid_idx; + vma->numab_state->access_pids[pid_idx] = 0; } /* From patchwork Tue Aug 29 06:06:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 13368617 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 AA6D5C71153 for ; Tue, 29 Aug 2023 06:07:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 471D1280036; Tue, 29 Aug 2023 02:07:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 420148E001E; Tue, 29 Aug 2023 02:07:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C0CD280036; Tue, 29 Aug 2023 02:07:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 197418E001E for ; Tue, 29 Aug 2023 02:07:48 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id ED3031C97A4 for ; Tue, 29 Aug 2023 06:07:47 +0000 (UTC) X-FDA: 81176110974.09.40D229B Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2082.outbound.protection.outlook.com [40.107.101.82]) by imf01.hostedemail.com (Postfix) with ESMTP id ED6E640015 for ; Tue, 29 Aug 2023 06:07:44 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="QG/TZBXS"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf01.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.101.82 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1693289265; a=rsa-sha256; cv=pass; b=aNJtkM9HJr8e+0iUIivgylSGxW5yKa2OJbMtF+U7DpAjHP9/8pQnx9AihYuYENnW4FYybF nBXVKpqY1bdKHlh9HZLVQ23d3YEiWp/w48UglpzE3NtZM0afP4Yw2h+oLZSLByOJ/vxVaC 5q2V1zR9rpvtpklYDpe5HOY/KG/pmVY= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="QG/TZBXS"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf01.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.101.82 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693289265; 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=eRMnvEZFZa+SXREsx1mEu87gMe0ygE3/OYfP96M/kuI=; b=tqH2KY+FlU2/S/O1ZT8EHZEEuqkbXFbF4dwG8JwOeH7rcF2d3YvMDjdLKVw5qbLn9KzuTH q/cIqjU0JTBj7/EmYwUn65GVPWxrRi8gx3BBIdMOO/yaCf2bYVqJiIaQeN+QdqzrvG03eq sIJJTKoEp9b9nAd3o1YtNs1eAZk8HRc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cd8cWr4GYmxgsC4snfcob7DPg6pol2Y5JM24Kze1/YWXl+9UOP7WP7Mn775ggJ1J+ohu4c57HzoEQK0CDTAPOEbjtmtss2rZIpQbVsRzybmBf29qDimqPXyAnVH7BUXMXuZ+dR40G623wvQoZO+8/pXHdnW+3CQPmWLMahH16EaN/+SXtG8Snw/yM4y3HZWZYsuALzTmpOUCmR1ho4WMljAiMY2weFxKjiadrjA9dXtAHfr0t+pRLHCqajdY4X7mZy+2O/j/Dd2QG/zv8c/vyBlhmlUjrxmROMIhdyz9EuTFbiX7KTAolFZnvJeZ5bVEx4d2TqRsDj79GlrfBjVqfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=eRMnvEZFZa+SXREsx1mEu87gMe0ygE3/OYfP96M/kuI=; b=XMLRmd1cEn9081XVxguoqMZnA+/KypUKyO1Tw24+vK/TCCNZEhOyz0pqXvC5EqvtS7UeHl1Pbyi4SJcJjXUD5RQBE26i5/wsKc3xrXuFFfm95d4Tz3fyQ0CuY6rF0yzhqhtisv5wjW8NUqzoaaU/hx7ILLK148+WfaVDxrkFE6rBmxd1rkn+4UmabMoshDYUB+L67s63r1LBKxsKTnt2fEIyPwoMKWzOchaAQ+oXio+n4ESbbevZVJa9cjoo1tIYa+A3JrRX0DhQinwaf19cCeFPSm0hnfQOwNhQ7uFyXVOXrTEtbx29iaGopLMPAPpVoOumcCz46fhv6p8NrjwfDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.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 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=eRMnvEZFZa+SXREsx1mEu87gMe0ygE3/OYfP96M/kuI=; b=QG/TZBXSPNNfuQN2YtQvQpPAtGZ3DC7aSK1A4ZS4+T6KP62lY8z/0ZhqbinHqxV/9wCnxNSKcPFVwoAWPObvI+sqS4ucvpM0Z6HaTV3vxBae0TVAf+F7uhVQi5Y9dMvsn601GPA2HJRzHiNfQzMle0K8/zpqlmX6malcsNddkCQ= Received: from SA9P223CA0029.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::34) by BN9PR12MB5274.namprd12.prod.outlook.com (2603:10b6:408:11f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.36; Tue, 29 Aug 2023 06:07:42 +0000 Received: from SN1PEPF0002636D.namprd02.prod.outlook.com (2603:10b6:806:26:cafe::d) by SA9P223CA0029.outlook.office365.com (2603:10b6:806:26::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35 via Frontend Transport; Tue, 29 Aug 2023 06:07:41 +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 SN1PEPF0002636D.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Tue, 29 Aug 2023 06:07:41 +0000 Received: from BLR-L-RKODSARA.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.27; Tue, 29 Aug 2023 01:07:36 -0500 From: Raghavendra K T To: , CC: Ingo Molnar , Peter Zijlstra , "Mel Gorman" , Andrew Morton , "David Hildenbrand" , , Juri Lelli , Vincent Guittot , Bharata B Rao , Aithal Srikanth , "kernel test robot" , Raghavendra K T , Sapkal Swapnil , K Prateek Nayak Subject: [RFC PATCH V1 5/6] sched/numa: Allow recently accessed VMAs to be scanned Date: Tue, 29 Aug 2023 11:36:13 +0530 Message-ID: <109ca1ea59b9dd6f2daf7b7fbc74e83ae074fbdf.1693287931.git.raghavendra.kt@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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: SN1PEPF0002636D:EE_|BN9PR12MB5274:EE_ X-MS-Office365-Filtering-Correlation-Id: 967e03bc-4b23-40dc-fa21-08dba8564142 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m3bo5lY0b4YCgRZ5cCU6gOWX+YW6/n2kkA4nWbeX2qvMf/Q0/ei0dLoSQ2hh6xmi2GNtkUd67U3PSrmdJWwopUyXcCVYfYOp4gc+R7RxdGBlHWtGvn4h+bv01wnn+WE3/Shmv++2MR2zBGbdZ8cUPlH3X9svQjDeSwUJAVMYeSRaki8Zm8PuUJCaMg6OYA8aW4QqxqF5Wiec63WNOmr6ZeiWNXnvsIHyIETKF/DHMKyqDpv0lX+rY0NUSwOWq0Q2kLUVjuiBXHghazRbL2a7Vm524EG3AfJiHe8cEaKFJ6EkGBUBWtwRnD8CUfLfOmPY/U1o+2PisEx4s+W2Tu+UJUHXC1lbXYIfFpvBa9bGneB/F8QcQjSdasoxV+HH4yri7vBeFNMte7TbDMTmgUOJVhSkppCALV3m7I62WoIKRir6b6nZiyEHQBwkvuoVthj+N2WZmCoGtKFKOibPrunV3dUU8+ZmAQ3OVZWRE4eFxwZKGy13/i4bWjaWs6urLUhby6cPCTibJqrTag7t/SH++j8oFV4OFY51DaR0IVKlKTwWEDfop8YHWvVW/wbDvbQYMzL5VgHhUbM4w3JW2g8ICN8W+QrNnUMfuksBzd1BO5BOwmTla9QF3XhwgnjjYfvLuIM1TYfK8iox1+drJgYYAJxwkNU5Td9zgA6K0Dcm7NQD4yby/Q2bntxADjhy9OqVxQo/6t1CP2cao/r9Vy11wR+3uvApBQmIcbwvbjnUOL0HK6WU+QPHY2t7RtTcajH7HK7NRt/d1o2a3RtSumIZJW/D5x3nocM4Rkm3Y5yQn/A= 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:(13230031)(4636009)(39860400002)(136003)(346002)(396003)(376002)(82310400011)(1800799009)(451199024)(186009)(36840700001)(40470700004)(46966006)(40460700003)(316002)(41300700001)(4326008)(7416002)(426003)(336012)(2906002)(83380400001)(47076005)(2616005)(16526019)(26005)(36756003)(5660300002)(8676002)(40480700001)(36860700001)(8936002)(6666004)(81166007)(356005)(82740400003)(7696005)(54906003)(110136005)(70586007)(70206006)(478600001)(2101003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2023 06:07:41.7994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 967e03bc-4b23-40dc-fa21-08dba8564142 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: SN1PEPF0002636D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5274 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: ED6E640015 X-Stat-Signature: xieq1ycqciuh1xua8sdrhrg3dyzqnyq4 X-HE-Tag: 1693289264-139582 X-HE-Meta: U2FsdGVkX1/+AQKD0EBVwmNpOqVAESiOub6tNvYKNKvx6dK0AxHZRQItTW6gKjLC3m+8Fy48rWT+5MRKR5gQnoWB72e91JZeMbil669OI/GzPi+wgY1vjytSJ/0xnia5NMuoAOG6N7YLXvSYnsL+ISvSHgxQF6vGNPkFZ9946ASSjWWb+lPtJ3G3thwIoFqovQZrC1C9it5jgXPNOz9x04SkY1Ufjsv0IWgrCDr4Wq9oCqzTly4F7StcS6j9k3hRLIsQpterE/0PmCojhf0VC5vPLJiGDZI81IaQMQk5ehgatgZK0h8YFoR1ymp78DX1PqB0E4g7xquWw5Cf0LwolN2G3IVF49ExKiSXI8k8pVRG9SGKNTx8l1z5Den44kdjU19alY4E77PsWMMF1KmX1r7qkuNcw5piVr0Iua/HtUVQcAyLb/ILuFdWKTxe1/MEtinIi5ICsebhJlkxwGxsfgv9KGvAXjNYP1yqYeEmXK/dN6byoM3AMFdLHdIO1wYatvj01jJdQ47Oed9kZYgvX1VtY0cKuOiCTcvayeA2qTKaI/ibbI0dmgX+qbnluv3uBMniLX+Nt0pdpfxTR78bbWOAh8YYBbk6qOY6fKOb0dDGBsRu8OS5U3nqYeOz6lspByUd0mnqR+CxP1ygjUaOtcwovFdRvK7fgTvOyYjwn/2GNwE2IlUL2w3TXaeFfVQiv21dLGGeRi5Q6dA6Gn2cvm5EvUs/GOMSDT9ydrSCvK7nT9uwNxIoivnaE9RB5r5rP9fl0b8AYZ9I9uPEEavKSI/eupMbvushXovDR1U3L+9FV00MknudPvfBasBXQPvhyTkEGPDuMhfHulJUpQX4E8n2YkhLVDk1hwZInk/3e97PzClinjzhNMOq0ksGrRWzDbuNwwgZd4X7W45PzMVm61lG9I5p2Ahe4k7nvVp3adAKP+02qCN44HrjUtzVO7OlnaJqLv9sfD6Xto+K/Ry LZoPigSk FPZ2c+OYkpmzlQyD3NNNPiZmb7sllAnrnmrfceHwoN2Amqg5F2mQTokOzjr+hWqRETwhCmy+6fEuPuF1sONjVX4n/s4HBcQcniu3v3TNZz6VPxdC/TYqrhOecntsGGWAHY/Z9Q4a0yr8uId0hlEnEgCptcPu6z8KCgYv+cMjm2pLVxedH9JOTgTa8jcOnExpG823+z/IMJZWhAk7B9eg6tD/DcxEwIQShidmbhrC89dXbU/VTRMni4PNfecNv+NUGj9FDt9ilR+TRvERdbzFVYc39vIdsIvQAw2lpym90Y5yUFT5j0LQSFOPGo3E1V2jcUTkrhKQV1RFqi+i8XLVBOjEdnVA8jOGDM/ulcSlV49j4Kpj+57LFOxg7FUyrHyklv9iS2Layjn802S0eDri4WRtu9cngFKO4ikxZiPh8aHggun5ADw9cie7LFHjY4QCYdf4skJJ+i3H6//ARSHrDmNom/b3FypfHcJyTjcn02RgeqrR5AaZQoctksg== 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: This ensures hot VMAs get scanned on priority irresepctive of their access by current task. Suggested-by: Bharata B Rao Signed-off-by: Raghavendra K T --- kernel/sched/fair.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3ae2a1a3ef5c..6529da7f370a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2971,8 +2971,22 @@ static inline bool vma_test_access_pid_history(struct vm_area_struct *vma) return test_bit(pid_bit, &pids); } +static inline bool vma_accessed_recent(struct vm_area_struct *vma) +{ + unsigned long *pids, pid_idx; + + pid_idx = vma->numab_state->access_pid_idx; + pids = vma->numab_state->access_pids + pid_idx; + + return (bitmap_weight(pids, BITS_PER_LONG) >= 1); +} + static bool vma_is_accessed(struct vm_area_struct *vma) { + /* Check at least one task had accessed VMA recently. */ + if (vma_accessed_recent(vma)) + return true; + /* Check if the current task had historically accessed VMA. */ if (vma_test_access_pid_history(vma)) return true; From patchwork Tue Aug 29 06:06:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 13368618 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 8C735C71153 for ; Tue, 29 Aug 2023 06:07:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 278EC280038; Tue, 29 Aug 2023 02:07:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 225378E001E; Tue, 29 Aug 2023 02:07:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C72C280038; Tue, 29 Aug 2023 02:07:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EE60C8E001E for ; Tue, 29 Aug 2023 02:07:54 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B77BB160646 for ; Tue, 29 Aug 2023 06:07:54 +0000 (UTC) X-FDA: 81176111268.08.9F76D90 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2040.outbound.protection.outlook.com [40.107.93.40]) by imf21.hostedemail.com (Postfix) with ESMTP id DAC2D1C0008 for ; Tue, 29 Aug 2023 06:07:51 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=aj+nFWWc; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf21.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.93.40 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1693289271; a=rsa-sha256; cv=pass; b=reJ+Dgb72fY0N3AHGuJepscHoB79PkJu5sb0F0i2usOhak8Xd9jSt0BCrtUNE09q9IWX4Y kpzfSiyBHqWzQPTV9bn/nfGsiskryJhnJatCMP9FfTDbiFLj2tMIlPr+iRN5ZKslIc99CB 1JamZjXJzXyfNLYCnEjuV6RL89upbqg= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=aj+nFWWc; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf21.hostedemail.com: domain of Raghavendra.KodsaraThimmappa@amd.com designates 40.107.93.40 as permitted sender) smtp.mailfrom=Raghavendra.KodsaraThimmappa@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693289271; 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=rqQHuMTEJJDtNpFNildcoC/NTNoRUydsBitUUo8dU0g=; b=yLyeujLoTjB3PIybRhpBb1h8HeGmRgwyC7TQw1YL/0MhQrWuZBGxWCh2gahX8SxzRzAmXp 6htD3zDRhMDeQJliYkThpMFVs3I6Helz5jKI3GJjUaSJeZjwkq3q9NMtfDl2o28J9MlX4y QxGEKaMiIGFIIk05cVc4IBRIcZzSAic= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wa/DYEqd1uxiRSqiZ2ivJQqhnTGn0NkJTZWGJPQBwRRSRdaK75z4oyQYzaeNm1Cficcq4tLzd2exr4Vk1P+SSx+RoKi5f4YHxxNvek3yna45cYgoWR7E4tpMor1MGmnl4/oJxF95rNEBtpO2E+1kTiFmm4maiFODft8vWm2aQ7buU0A3XTqxQcStynbK4/EZCwxMDx4mSv5/sOfSRAjous7pCRCfcljJFIHGAPKZALeFYEaq3w/FRKb6jF+x2s2rp/HgZO/oI6b6RlGx4DwM8bWAKraOxE8ddABOlBwy1p+s9Y7nvh04UaQMxz1bgPII8TevgULLvkIvvRxbM0BR5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=rqQHuMTEJJDtNpFNildcoC/NTNoRUydsBitUUo8dU0g=; b=SeHE7ENs1XLlD/+F+QcD1XzVeFkBquQkPdBvZukQ0JBlVY95zDTr4130XL0Uv3ZLWyOA7j/ec8qC2DpDIGSslF6DblgxrVQhWL1oDTBreQzk2lOYeW3iliyoTlD+kZPAllgXKDwwNxhk2Zu7WaEQ4xtUVB4PoL5KByU9L5oo+dlxrgt6wV8kPSiB6oiBWM4rFXZBikaa2U5HrqflOu7T5dXPnwL5nkj9Iazap3nBjQ/jQpH8SXpngA6ob/Qv2w2pfob3pE4R37XOE+P/8UpL563QLuJFfaPDTM95nyh6Dxo8cNYypICRVDt3G5UNGkNnoJER+s6JLTnZeiyQ05uNpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.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 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=rqQHuMTEJJDtNpFNildcoC/NTNoRUydsBitUUo8dU0g=; b=aj+nFWWc57XKyiqQFLYqwYX7uWp1+c7znXmbKagmfT3isjl5ZK3pKegVb3+MDYdfDDLUEG+HT157dRU0lZpa2CEodEfc7hqU3vvTeypRiKxXhnHmnxAc5hGJmZb/JbVX5QMCu2yndPwoM1pwsAvraGzK96MmkXXwc6woJtN38BQ= Received: from SA9P223CA0011.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::16) by SA1PR12MB8142.namprd12.prod.outlook.com (2603:10b6:806:334::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34; Tue, 29 Aug 2023 06:07:48 +0000 Received: from SN1PEPF0002636D.namprd02.prod.outlook.com (2603:10b6:806:26:cafe::bc) by SA9P223CA0011.outlook.office365.com (2603:10b6:806:26::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.36 via Frontend Transport; Tue, 29 Aug 2023 06:07:47 +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 SN1PEPF0002636D.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Tue, 29 Aug 2023 06:07:47 +0000 Received: from BLR-L-RKODSARA.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.27; Tue, 29 Aug 2023 01:07:41 -0500 From: Raghavendra K T To: , CC: Ingo Molnar , Peter Zijlstra , "Mel Gorman" , Andrew Morton , "David Hildenbrand" , , Juri Lelli , Vincent Guittot , Bharata B Rao , Aithal Srikanth , "kernel test robot" , Raghavendra K T , Sapkal Swapnil , K Prateek Nayak Subject: [RFC PATCH V1 6/6] sched/numa: Allow scanning of shared VMAs Date: Tue, 29 Aug 2023 11:36:14 +0530 Message-ID: <0ff0d56b88a64e2017b427f37b15ab41aa5d4019.1693287931.git.raghavendra.kt@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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: SN1PEPF0002636D:EE_|SA1PR12MB8142:EE_ X-MS-Office365-Filtering-Correlation-Id: a9766cea-cf3e-48c4-cf1d-08dba85644e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SfPr6kq8rqe2EGdrAEEE+fJA1uNbGBTr7Wczi3D6wnECj6wJKahi7SyPVoPOzAED+Un+I53agTVyyWBeO3RYB54/pSMhBjk3gFuSlVRNhrQqNfirzyDI/ble2nodM8H6ioy8v0lFKxfrMkiJzibmWhnqhjHhvnGMq+tTKy0/rE2y2ZyM8mCW0epv8dC8Nhe/lVPB8vwMrBvPtyvUAmfyXAKfV5kYWu+2hqUfsHtYAyEKOSEHVr5A8VebV/yPGIXL4Mr6iFZDC1xmBrQc/ei6PKYzMm3uAY2MKjHY4t9d6KgTcSEEpGYL/6jojJ6zZHP4shRXWtqCwIvONlPao1Cylvz5SJFyt1h4CerBWKsgmHBuJBBd3RTl8nBsj634fiCDAL1ePBIg1korPACOWsA/nkChMjFa0PR5dDfqMc9bV2k7y2ZXp8WFaaYmTk17eXui16dOy5Ue47zTf8i3rGy96U3CP7L8JJ+nk/UJjAkHSIbxORn+oAeM9Iu7Z/74uIqNFTP4/mRSVCZi1TtFBaMOBPNexvgxjaPBlvn8ykX0IQ/FDC6lV90gkRnw9pjfxNDSLXVoLej05QEiah/sdfcA8dXBfOT9XxulxxJIfX8xEqpidiYw/INdGOnDDVSrLOj5XXzSfTqK56y+47AzINtlVG50pRVPE57ikkrsgKPuV9gmIS7xsA+eLIOzr7DPh0fXc5yYRR+h15Q5JmpgIbs9sEAvO84JoUyLgGvvIPWS7NcA2R5Lvjv8cfXgtv2pR8BnBg4IxFahssDwJ0H3Q5kJASdQBUWvsl03b1UaEJNoC7A= 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:(13230031)(4636009)(346002)(136003)(396003)(39860400002)(376002)(451199024)(1800799009)(186009)(82310400011)(46966006)(36840700001)(40470700004)(82740400003)(6666004)(7696005)(36756003)(40460700003)(356005)(81166007)(40480700001)(36860700001)(47076005)(2616005)(2906002)(336012)(426003)(26005)(16526019)(83380400001)(478600001)(110136005)(41300700001)(70586007)(54906003)(70206006)(8936002)(8676002)(4326008)(5660300002)(7416002)(316002)(36900700001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2023 06:07:47.8931 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9766cea-cf3e-48c4-cf1d-08dba85644e4 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: SN1PEPF0002636D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8142 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: DAC2D1C0008 X-Stat-Signature: 9h7ez3inj4sh79s8ugui9a7475hge7m7 X-HE-Tag: 1693289271-164162 X-HE-Meta: U2FsdGVkX18xojlwQKUsidYP9R9VLautEPi+UEjJPeQPEGdnzhrNrpNRL0YBThBDUZsaRSkggzlRwU9u6KscZIEQDr9DY3UBvObKdnqbMcaevxEVdz0T1oIkJxBSpYnjojwqfe5FzQc8yCJXTYk8+aBf1CDv4bQWt6r024MexbwFunO0xv7Edhq+LRuIemO6daqrg48Lv7V7h+F8oBHHtPmyq1LtM4E4Dwza8PCX4QRtarlQdPlr18xUkBO/RWWsgu+f2xJMFUPJLIMTGoHrKYEhV0kMazq1yQavKEF+49o0vPBJh/mJZilj9VM+dBoeV+nqHLsZZBP0qSeM9ZEM4KWLUvsi6N44tE7bvZv46dBkQkBM1v+YORPZEXMHVi61fTMFxTo0c8jPbifc7U/kyASuaIX0XE5HJQtffZ5HldFz3mCTlHkjXWIjR6GyrKk2gkiswbBN0L013844AR0ycFIAa39V/xjA0YD3+Vw/8Jn1Xg6tDLphhhARXmghSkhZ7hCve0AF1clR6j6avVjHYXn2BjXpL+am3rthNjvS7nSVYalaylviCPGUUFnr8D/QZno5QsaE0PteXor11PLly2nByY+yuTMQnj0XOjEFKuqYcW7W3Vu2kyOZ6DhRWEoSEoD2khbYvgJjadLYL+zTAJs60mMnQ1p1lRS0RCFcHHlhAygqBwz/TqBNjjzg8PJIR3nEvoR5hoCU17h3RXGqEsyAHuxjMOCFywAPmh3sAVfQWYKeqG5zE6aiS2wNEnmo6Z671p1csNSPESQAzPqSdTY7Fk8vdB0VaiOPbrI4267FIhG++L9gV5yuKv9LrBbNeVK0OzZ6blXMOpnfdok30YESvtVQdwlvL8oH0P0GVYu6nUaAIlnQ4EOUjDYPQqFXZ6UbvphWCIA4ocxRlpO0kTZ0Lo/R5S0+gyKaxe1kRqcIOBRm5Spz6Qup0aZV4Kt1ek0WBDQP4fWJNKuPeDK DRMj+MNc yW+3Og5eaCyTspOyenQCeUFbXdzbXhENUWt702wTFpsclFVnmmCgKRygr6GEb7KAr6TJu3qPkCeayfJYPjbNWUEa6UEArs+GTuLkWkGrVu5O6ZK8kMgEu9p7FZUvwRLdX0cSDtuzW1JuhHjrNkjjgohmFQKOAdJboiP8mE2mT/YV/DMmI5M4J/2kyV4tqQBDItaZm2BGuyjTqhMvFXpbomIu9HgP5OcofzoQcwdpkhvS38jy84eT2csrK6+gNw04WnGjX1zl2bSX0zGka81DTakoBFJit3lhGgpIje/L9iXirsSr4XaOLxIWc5Mu4UaMy1Fiqo4MC7yMSbOfIqlI2kSvmU/cvRU/E8B+Gu058VU+hEyL2ILW+Y5VQ3f/0B6tIa1qrQC8Ym5gjMB4O+xxRkTXDvGmBHlK8Uqj0EgbxZZK4ecNRTbu335iDt9rTweaokR2bVb8UsQdIPqf4BBIvC31A1cQWv7zywt1cs+DEuTBqO28Xak5g4gahMw== 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: VMAs being accessed by more than two tasks are critical. Scan them unconditionally. Note that current patch considers full history of VMA access. Signed-off-by: Raghavendra K T --- kernel/sched/fair.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6529da7f370a..70c8e62c1a89 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2981,6 +2981,19 @@ static inline bool vma_accessed_recent(struct vm_area_struct *vma) return (bitmap_weight(pids, BITS_PER_LONG) >= 1); } +#define SHARED_VMA_THRESH 3 + +static inline bool vma_shared_access(struct vm_area_struct *vma) +{ + int i; + unsigned long pids = 0; + + for (i = 0; i < NR_ACCESS_PID_HIST; i++) + pids |= vma->numab_state->access_pids[i]; + + return (bitmap_weight(&pids, BITS_PER_LONG) >= SHARED_VMA_THRESH); +} + static bool vma_is_accessed(struct vm_area_struct *vma) { /* Check at least one task had accessed VMA recently. */ @@ -2991,7 +3004,8 @@ static bool vma_is_accessed(struct vm_area_struct *vma) if (vma_test_access_pid_history(vma)) return true; - return false; + /* Check if VMA is shared by many tasks. */ + return vma_shared_access(vma); } #define VMA_PID_RESET_PERIOD (4 * sysctl_numa_balancing_scan_delay)