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;