From mboxrd@z Thu Jan 1 00:00:00 1970 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 DBDD1C433EF for ; Fri, 18 Mar 2022 10:49:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 441BC8D0002; Fri, 18 Mar 2022 06:49:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F08F8D0001; Fri, 18 Mar 2022 06:49:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B8718D0002; Fri, 18 Mar 2022 06:49:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 1CC1B8D0001 for ; Fri, 18 Mar 2022 06:49:56 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D4B5360560 for ; Fri, 18 Mar 2022 10:49:55 +0000 (UTC) X-FDA: 79257186750.09.91EFB4C Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf28.hostedemail.com (Postfix) with ESMTP id 3B222C0031 for ; Fri, 18 Mar 2022 10:49:55 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5B473B8219B; Fri, 18 Mar 2022 10:49:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E74EC340F0; Fri, 18 Mar 2022 10:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647600592; bh=1pzfZml0Q8sVwbCaBTnrUqVKnz0JRxDGgLD3gFXNCM8=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=i76iyzoCYoGQEJ1n15PMzE5+UrbSvRDfuGBeJQk7KLJvK+HxowNqX0wbeLcUDXwkB IZ9GlDZgNwgBy2v1spJUXsXZxd8Jggdis9ZA1VrMuTBKk+N1jD6H8fpCEZbWN86ICp PsluMlfr7+k9jFMGF5Bx+Csf8ceKLBe9EqRDGJEG8nN4PjKrtCCF/QKlZr60NuXnBG +nogFcS2s2SlLJrf3WxZEnJE5q2lrShbpnmXjPpDB+49iwh5sXnA2e9ypDUcwAoRXA 9hHH3evjrpcsb0/yO6GH2U9EbeZHfafCcLGmOWN1y16/pHMUTD1STKNyUdVytY/42E 2j/e0Db4WUOug== From: sj@kernel.org To: Baolin Wang Cc: sj@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/damon: Make the sampling more accurate Date: Fri, 18 Mar 2022 10:49:48 +0000 Message-Id: <20220318104948.26387-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <5cb98e07-1e51-e376-8e67-dffc92f24941@linux.alibaba.com> X-Rspam-User: X-Rspamd-Queue-Id: 3B222C0031 X-Stat-Signature: jryxybot5jxanbdd9hhp9izf5ib7sjhw Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=i76iyzoC; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org X-Rspamd-Server: rspam03 X-HE-Tag: 1647600595-268282 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: On Fri, 18 Mar 2022 18:01:19 +0800 Baolin Wang wrote: > > On 3/18/2022 5:40 PM, sj@kernel.org wrote: > > Hi Baolin, > > > > On Fri, 18 Mar 2022 17:23:13 +0800 Baolin Wang wrote: > > > >> When I try to sample the physical address with DAMON to migrate pages > >> on tiered memory system, I found it will demote some cold regions mistakenly. > >> Now we will choose an physical address in the region randomly, but if > >> its corresponding page is not an online LRU page, we will ignore the > >> accessing status in this cycle of sampling, and actually will be treated > >> as a non-accessed region. Suppose a region including some non-LRU pages, > >> it will be treated as a cold region with a high probability, and may be > >> merged with adjacent cold regions, but there are some pages may be > >> accessed we missed. > >> > >> So instead of ignoring the access status of this region if we did not find > >> a valid page according to current sampling address, we can use last valid > >> sampling address to help to make the sampling more accurate, then we can do > >> a better decision. > > > > Well... Offlined pages are also a valid part of the memory region, so treating > > those as not accessed and making the memory region containing the offlined > > pages looks colder seems legal to me. IOW, this approach could make memory > > regions containing many non-online-LRU pages as hot. > > IMO I don't think this is a problem, since if this region containing > many non-online-LRU pages is treated as hot, which means threre are aome > pages are hot, right? We can find them and promote them to fast memory > (or do other schemes). Meanwhile, for non-online-LRU pages, we can > filter them and do nothing for them, since we can not get a valid page > struct for them. For some of DAMOS actions that you mentioned, that could make sense. However, that wouldn't make much sense for some other cases, especially for manual DAMON-based access pattern profiling. After all, we already have a mechanism for this case: adaptive regions adjustment (or, regions split/merge). That mechanism will eventually separate out hot oneline-LRU pages in the memory regions. Before the region is adjusted, reporting the whole region as hot looks like a right result to me. Of course, I admit that it could take too much time to converge to the optimal regions, and there are many rooms for improvement of the regions adjustment mechanism. I think we should pursue the direction (improving the regions adjustment mechanism). FYI, I have some rough ideas for improving the mechanism including partitioning regions into more than 2 sub-regions if we belive it is not making a good progress. Nevertheless, I'd like to first make a methodology for evaluating current accuracy. For that, I am planning to implement a page-granularity access monitoring. Thanks, SJ [...]