From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (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 5EB9E25A628 for ; Sun, 26 Jan 2025 02:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.110 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737858811; cv=none; b=Lyg6cB+DbBAI2aA0VqAipUsIj5ihrIpmMvrpc5VzJSa8hFvpcumn6fIHwW6Lmbodx8I898gm4IP6zKJ3KwQT/kLXec29HLwzwysyZa9UFWBmgGVH+0RvYSDjV73k0V2iGSinwKkfkZlYROqnmqlfwy0aSs62VpRuTBMCHRGxCBE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737858811; c=relaxed/simple; bh=xULJqkbcobMQf45OCsxbtRguQ+N1rSgQwz8hG1Ruj2s=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=S121zOfK9sTc4AAwVDlKfi6r6SQWN/96ItzpOa3SKXwiGLue5xB8aqqBxM2ekM9OScBNT9ZgEP9DRozdnzBvTcvN1ns8IgoDv5y/rtpWH6tRx1BVff7lJa/cfMA4fv8lKw/POKmR2R28t4/GLUf8M6spHcFuzPrto5k9guFiahA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=VjtCBmZS; arc=none smtp.client-ip=115.124.30.110 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="VjtCBmZS" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1737858799; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=yJARYSWlOupVxuoaYY576KiiQlNDmztq5lfwbUGtEkI=; b=VjtCBmZSI5AUG6SfXVl/pEX9wK++VJ8M3+8acRq0Hl3M3maqOQBi4JHx3C5WW4X4qC3iKW4RuoqXA9pGYUT91HZgIena/CQnEsyoHRiXZBH8eWSHV2bIusky6SNJkQObUR0biK/4xUVsdhA+uCc3m0iNImEG85aCZn4bqmC01GU= Received: from DESKTOP-5N7EMDA(mailfrom:ying.huang@linux.alibaba.com fp:SMTPD_---0WOI6EsM_1737858474 cluster:ay36) by smtp.aliyun-inc.com; Sun, 26 Jan 2025 10:28:00 +0800 From: "Huang, Ying" To: Raghavendra K T Cc: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [LSF/MM/BPF TOPIC] Overhauling hot page detection and promotion based on PTE A bit scanning In-Reply-To: <20250123105721.424117-1-raghavendra.kt@amd.com> (Raghavendra K. T.'s message of "Thu, 23 Jan 2025 10:57:21 +0000") References: <20250123105721.424117-1-raghavendra.kt@amd.com> Date: Sun, 26 Jan 2025 10:27:55 +0800 Message-ID: <87o6zub978.fsf@DESKTOP-5N7EMDA> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Hi, Raghavendra, Raghavendra K T writes: > Bharata and I would like to propose the following topic for LSFMM. > > Topic: Overhauling hot page detection and promotion based on PTE A bit scanning. > > In the Linux kernel, hot page information can potentially be obtained from > multiple sources: > > a. PROT_NONE faults (NUMA balancing) > b. PTE Access bit (LRU scanning) > c. Hardware provided page hotness info (like AMD IBS) > > This information is further used to migrate (or promote) pages from slow memory > tier to top tier to increase performance. > > In the current hot page promotion mechanism, all the activities including the > process address space scanning, NUMA hint fault handling and page migration are > performed in the process context. i.e., scanning overhead is borne by the > applications. > > I had recently posted a patch [1] to improve this in the context of slow-tier > page promotion. Here, Scanning is done by a global kernel thread which routinely > scans all the processes' address spaces and checks for accesses by reading the > PTE A bit. The hot pages thus identified are maintained in list and subsequently > are promoted to a default top-tier node. Thus, the approach pushes overhead of > scanning, NUMA hint faults and migrations off from process context. This has been discussed before too. For example, in the following thread https://lore.kernel.org/all/20200417100633.GU20730@hirez.programming.kicks-ass.net/T/ The drawbacks of asynchronous scanning including - The CPU cycles used are not charged properly - There may be no idle CPU cycles to use - The scanning CPU may be not near the workload CPUs enough It's better to involve Mel and Peter in the discussion for this. > The topic was presented in the MM alignment session hosted by David Rientjes [2]. > The topic also finds a mention in S J Park's LSFMM proposal [3]. > > Here is the list of potential discussion points: > 1. Other improvements and enhancements to PTE A bit scanning approach. Use of > multiple kernel threads, throttling improvements, promotion policies, per-process > opt-in via prctl, virtual vs physical address based scanning, tuning hot page > detection algorithm etc. One drawback of physical address based scanning is that it's hard to apply some workload specific policy. For example, if a low priority workload has many relatively hot pages, while a high priority workload has many relative warm (not so hot) pages. We need to promote the warm pages in the high priority workload, while physcial address based scanning may report the hot pages in the low priority workload. Right? > 2. Possibility of maintaining single source of truth for page hotness that would > maintain hot page information from multiple sources and let other sub-systems > use that info. > > 3. Discuss how hardware provided hotness info (like AMD IBS) can further aid > promotion. Bharata had posted an RFC [4] on this a while back. > > 4. Overlap with DAMON and potential reuse. > > Links: > > [1] https://lore.kernel.org/all/20241201153818.2633616-1-raghavendra.kt@amd.com/ > [2] https://lore.kernel.org/linux-mm/20241226012833.rmmbkws4wdhzdht6@ed.ac.uk/T/ > [3] https://lore.kernel.org/lkml/Z4XUoWlU-UgRik18@gourry-fedora-PF4VCD3F/T/ > [4] https://lore.kernel.org/lkml/20230208073533.715-2-bharata@amd.com/ > --- Best Regards, Huang, Ying