Received: by 2002:ab2:3b45:0:b0:1f4:bc7c:a2d3 with SMTP id t5csp50455lqf; Fri, 12 Apr 2024 01:17:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUCbe5jXX4s6VwynjQrlMrOb+7fTsbjeUkxYc9feLwDlnm6RTZD1aknGQrtxZQ41qFXzRKwCiKygO/bV95CSb74LZO1gLwy0Ptxj4YQaQ== X-Google-Smtp-Source: AGHT+IE/ipK0iM5/8KUq34lugRB/GfP0CUId6JiZALrIemooVExQgtMYHABqK8qSSDwNCnIgXr85 X-Received: by 2002:a37:e306:0:b0:78e:c0f7:54fb with SMTP id y6-20020a37e306000000b0078ec0f754fbmr2258611qki.50.1712909837165; Fri, 12 Apr 2024 01:17:17 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b26-20020a05620a127a00b00789f0d4acdesi3102920qkl.317.2024.04.12.01.17.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 01:17:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142217-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Zlz+3DhJ; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-142217-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142217-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0DD5C1C241D5 for ; Fri, 12 Apr 2024 08:17:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A3E94F200; Fri, 12 Apr 2024 08:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Zlz+3DhJ" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060.outbound.protection.outlook.com [40.107.93.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 796CCEAC7 for ; Fri, 12 Apr 2024 08:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.60 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712909786; cv=fail; b=VAPl/VUWlLWtcA0b76mZvG2b1Wd4DkEnlI0nEPj/1hYf/HlyzIl94jSF4IyxCaELfK9QObfM1B2sDjxvaX1ebRGsg7pba3dN9HLXo7aRqgChYBvIYqZsnmbw7TJbYnEKe69t960Riik8GKTG7QQTVJizTtZZdTfCrJzbTnTPITM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712909786; c=relaxed/simple; bh=1Wb6yTco6JGQVeT5DD0MYmx4vuChKBriU3M8ssOxAoE=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=GKLxjTxPnhk6r53iUi5qVnMxfFxQcekq1ErpbeU0dcaCzqEPkKQuhR6IjC6k1kjSY/NBpt4BU/KE/si6RoGGYX2fzMAzGaKAYBuNgioheWF8WUP7xCH6wLn2ntnVSowTFuKiuPf+BG0JZmjMarzIntEsfGs2G3lfGUt5mcrvbTw= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Zlz+3DhJ; arc=fail smtp.client-ip=40.107.93.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KaHLHYhvdDiaWaeWjSlqh5trwn5eG9NWWwhXV7ISaNkH1dY94aNSRx7HyMM6Z/rxZx+63adIn4O7ZUmRVLo9xh8SxveNZL/tD6GMc8jYRwtOEHLO9No2jyEQ5aiomh20Q6vm19+WqPOK2Aui5yBfuKiwPMEFZHgZNAaDmaz0C1SAzQClpyJWwUj/b9bijdem3qPTqSvVLf8HqWfDvMnCZqG6qUwDyWqKiICtIa7K/TaQn875DsrkW+ymRH7v+qrCsOsaf63Bc5CnY9X5Mkk1UNbWfKz4sCB5FPY/ZUZp8skSka56kHzfISKaBYdtW9sV0UCzkG4lbBG6ll7O2rde/w== 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=BxqYwrsoaYRLeksbIuOGTcFlgZc0N4LWJJPTfPMneEY=; b=R8KCtLMqqXgKU1D9wISoQrgfoD0NwFElIPo/CFMXRaJN4qBosbE0RzetK7zFwR0PL4SbUhc56VH+fqr4GhsnGugIFoqzqPBZP/QCvcQXBh8mdffi3RC9uX2sQDaCav2KjA8GCv7jxu4CNywcwvnkYzlMghXxFpFQvrQJRg6v6cGbAtKkdi9ABxa7Gmo2Jkf9/1KhTAc6oCl1hqLCt7MV4Req+MacmWJ1OpdFcjFoa8cSIU17j+/uCHxSrTTsbjLJl/eKjAuBr556PlApV6NgYd2csr0pvl5tfCQ5B7h7CZfvWJWd4ZTfqhjvlzZieQc7d9jDdP8/avG06nygtvbWGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=BxqYwrsoaYRLeksbIuOGTcFlgZc0N4LWJJPTfPMneEY=; b=Zlz+3DhJ3M9/LK2jsacNHs6FCM3a17wrr+TvECo5detKKg0qlPQ22c8Zszi75bxfJogsoexpxmwTqVR5xbZpJw2eVSXLGjd4L3tsMaJQ6WerUY2apAC9p9BX3bjHMCGRI9lyTn94199fI9HV4HW2uqod8QFM3KlIVUMaYES/D+c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from IA1PR12MB6434.namprd12.prod.outlook.com (2603:10b6:208:3ae::10) by DS0PR12MB6581.namprd12.prod.outlook.com (2603:10b6:8:d3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Fri, 12 Apr 2024 08:16:21 +0000 Received: from IA1PR12MB6434.namprd12.prod.outlook.com ([fe80::a628:d2dc:a0e9:67e2]) by IA1PR12MB6434.namprd12.prod.outlook.com ([fe80::a628:d2dc:a0e9:67e2%5]) with mapi id 15.20.7409.042; Fri, 12 Apr 2024 08:16:21 +0000 Message-ID: <8b073658-268d-4d3e-bd94-3fe95c948bd9@amd.com> Date: Fri, 12 Apr 2024 13:46:12 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 0/2] Hot page promotion optimization for large address space Content-Language: en-US To: "Huang, Ying" Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, mgorman@techsingularity.net, raghavendra.kt@amd.com, dave.hansen@linux.intel.com, hannes@cmpxchg.org References: <20240327160237.2355-1-bharata@amd.com> <87il16lxzl.fsf@yhuang6-desk2.ccr.corp.intel.com> <87edbulwom.fsf@yhuang6-desk2.ccr.corp.intel.com> <929b22ca-bb51-4307-855f-9b4ae0a102e3@amd.com> <875xx5lu05.fsf@yhuang6-desk2.ccr.corp.intel.com> <7e373c71-b2dc-4ae4-9746-c840f2a513a5@amd.com> <87o7asfrm1.fsf@yhuang6-desk2.ccr.corp.intel.com> <9ec3b04b-bde8-42ce-be1b-34f7d8e6762d@amd.com> <87il0yet4z.fsf@yhuang6-desk2.ccr.corp.intel.com> <8692d514-d1c8-4fbf-84d7-1ad609480070@amd.com> <87cyqv59bj.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Bharata B Rao In-Reply-To: <87cyqv59bj.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0136.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:bf::23) To IA1PR12MB6434.namprd12.prod.outlook.com (2603:10b6:208:3ae::10) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR12MB6434:EE_|DS0PR12MB6581:EE_ X-MS-Office365-Filtering-Correlation-Id: 7806f466-3b8e-43b3-bfa7-08dc5ac8d5d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pR6YFoiwJQBLPkXSbOIkdimk08ir7KuE+E6KkBnNXSX2WVgkeVGbJ3cxpY3y+fIhVFJzTQTe27NLznPKiHa+pXV6QiZqQvzeFFJ5FpNQSRx+d5SRpa8IxKFeVsAog46bmYnDy5qJne8l/jU3N9aHkK7I4R8KQ3pQTqQRi3YHlkHl+MgBbMnGr/AfL5KvXg9AFkuWHHFD5E64SzIa8noGbeTUb/PriUqMZpLWUV3QkeqzMngQS9wKjLYmDKK9mbIK57tBuWPq95g9qT36VfRv+G00vN8WElPHeO3WJtENa0SDFiT8qo9NKhm6nCenjElC4+xOx3mEIj8Aabyqd8mDwVzOihIa3kK5I23YN2b+C8HpbG7oZmpiU/hSmKpA9++cIEs1fs/ZMbjLvxbtsDstyHfpvVaFOpBJ8MM/nSe/ouOs3M8/zi4VqCBFZGDIcgVM8QlVv77xoQ821Lrfq5multKLgwkuCR+Zz9XVsrwb/Q7o5g5rdp4LHlaOxCdDJFV1VETTIi2d6TXAgPY6I+sjBUyBKQukC9Hrp+0bHM2is4iV6sUKS/tD63CU8DGIZU9DI8GWun8xOQNYBgyWQoKOw8pRoIlqrk5Gzmy42eLy+nclvBXYfEyWIdqCSid3sIDIxRHzmqb0sg/4H8XKCt1E8jjbDZ6MCgKNh425HjCjlQQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6434.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MjNQdDVmbkVhMHBEQ3JQT0lSdEh4d2w5a1hWb20rR08zZ2thZzJRK0JTQkFG?= =?utf-8?B?THAxdEdFcC9TbXdpSEpVb2Z2Umcwd254M2FZUUFsUWg3WTJTcS82RkJKZzlp?= =?utf-8?B?NHZka2wvTTBYV1M0YXhMSVpjOVR5c0pCeXhJaExCVVpkN3l4ZnZISGdzUXhu?= =?utf-8?B?elkrdXVHd2wzTmJwanpsUjNmamF5YzlhUTdJYW94aEhuSXVIYktLT3d2V29l?= =?utf-8?B?OFhMZG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OUFJTTdHaVF4c2cz?= =?utf-8?B?OVJ5anBFZUhMU0lqbTc0YmlqWDMyOFp0OHVNK20wUGFxSUQxcTl0SjlGRDZn?= =?utf-8?Q?l87ADqr4GMWpiCdkpWrzkSKP6?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7806f466-3b8e-43b3-bfa7-08dc5ac8d5d4 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6434.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2024 08:16:21.0343 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dSLj9JJHYgL+RrjcxjBob2tQHTM1qbyGENyilErObgkcIY2e8N3YYXdUzvj/EMDgY5XoXQ+XkAwBW76iNy2ucw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6581 On 12-Apr-24 12:58 PM, Huang, Ying wrote: > Bharata B Rao writes: > >> On 03-Apr-24 2:10 PM, Huang, Ying wrote: >>>> Here are the numbers for the 192nd chunk: >>>> >>>> Each iteration of 262144 random accesses takes around ~10ms >>>> 512 such iterations are taking ~5s >>>> numa_scan_seq is 16 when this chunk is accessed. >>>> And no page promotions were done from this chunk. All the >>>> time should_numa_migrate_memory() found the NUMA hint fault >>>> latency to be higher than threshold. >>>> >>>> Are these time periods considered too short for the pages >>>> to be detected as hot and promoted? >>> >>> Yes. I think so. This is burst accessing, not repeated accessing. >>> IIUC, NUMA balancing based promotion only works for repeated accessing >>> for long time, for example, >100s. >> >> Hmm... When a page is accessed 512 times over a period of 5s and it is >> still not detected as hot. This is understandable if fresh scanning couldn't >> be done as the accesses were bursty and hence they couldn't be captured via >> NUMA hint faults. But here the access captured via hint fault is being rejected >> as not hot because the scanning was done a while back. But I do see the challenge >> here since we depend on scanning time to obtain the frequency-of-access metric. > > Consider some pages that will be accessed once every 1 hour, should we > consider it hot or not? Will your proposed method deal with that > correctly? The proposed method removes the absolute time as a factor for the decision and instead relies on the number of hint faults that have occurred since that page was scanned last. As long as there are enough hint faults happening in that 1 hour (which means a lot many other accesses have been captured in that 1 hour), that page shouldn't be considered as hot. You did mention earlier about hint fault rate varying a lot and one thing I haven't tried yet is to vary the fault threshold based on current or historical fault rate. Regards, Bharata.