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 8A17BC54E67 for ; Sun, 17 Mar 2024 15:32:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC7786B008C; Sun, 17 Mar 2024 11:32:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C771D6B0093; Sun, 17 Mar 2024 11:32:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3EDA6B0095; Sun, 17 Mar 2024 11:32:05 -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 A0C4E6B008C for ; Sun, 17 Mar 2024 11:32:05 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5D0D412040F for ; Sun, 17 Mar 2024 15:32:05 +0000 (UTC) X-FDA: 81906921810.14.E1D1D7B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id CCF52C0019 for ; Sun, 17 Mar 2024 15:32:02 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hEE4L9kZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710689522; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to:references:dkim-signature; bh=JCf7zjtTMY/7NGycG8Vn01xAci0vdgx81Ci2/gIl8Yk=; b=A5T9dkCZc2gvX+8PJ0ezPfjQC4ueTGPu/zcJalBqlezHbjFialihXN4mMk3L5ls4cAaZNT B3BIVX0OAPoJrSKc8df9BaESFFbLhb5BZqAhbJqegHM9g06V8b5pOr3i7hnw6bdGSn3xJt PxTex80J5dAGZ/YuHFp68KGJRKNTHAw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hEE4L9kZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710689522; a=rsa-sha256; cv=none; b=ECIYBpSSJInjcPLtm/nnixv6IhM8jdsFkkrBsrB0j2TZ+MBXNLI2ucVCYwszmcdbaA4qxu 3g2LiR2gFGjKZAc1+1eXE17q1YC4Quv9/sLFp/CC6KrbbqEeIorcbYZ9Qh+bM3Fr1qOmGH Ue7aXmBrGm1aIheLmo8wnjPY7T5NQmM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D01EC60439; Sun, 17 Mar 2024 15:32:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 692CFC433C7; Sun, 17 Mar 2024 15:32:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710689521; bh=aCYFY/11lppuG/k/2U8haJIK+dIQGr4XGZfbv1NLwUg=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=hEE4L9kZT8zfLRt5F2baOwmW1D9Ggghq9Q2fJ1um2zpSmmwD4Y9VvtNk88rIj7+w4 gn6EgTLE3ER2QYQWUm9kaA7O21Wtd60duvdnMwEoc5vFfPu9+CSsDhkAHxiOOAnKU8 1/48GZbGsSiUZ/YwgQ3R4IURVjGnTdVVu8P4fhD5Mbp9YVAuJiulM42RjVwIL7Kmnf aE3HIv6FCUQOzvKqWQnYEkC4Lm9GXm07nbljKNrbfVOaedyH8R1JfUA7YfON+eVXwF RaeKdDpzKh8vGvpb6JnzFH9W6K9IJJ9s2TuZ9ibb++mk0QuUqTKQ2N2P09gWRDafw3 1RQ70y0IGzB3A== From: SeongJae Park To: Honggyu Kim Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, akpm@linux-foundation.org, apopple@nvidia.com, baolin.wang@linux.alibaba.com, dave.jiang@intel.com, hyeongtak.ji@sk.com, kernel_team@skhynix.com, linmiaohe@huawei.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, mhiramat@kernel.org, rakie.kim@sk.com, rostedt@goodmis.org, surenb@google.com, yangx.jy@fujitsu.com, ying.huang@intel.com, ziy@nvidia.com, 42.hyeyoo@gmail.com Subject: Re: [RFC PATCH v2 0/7] DAMON based 2-tier memory management for CXL memory Date: Sun, 17 Mar 2024 08:31:44 -0700 Message-Id: <20240317153144.11931-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240317083635.2085-1-honggyu.kim@sk.com> X-Rspamd-Queue-Id: CCF52C0019 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: c8daupaf7yeg1kc5t6sd9yb61nfiu68d X-HE-Tag: 1710689522-280308 X-HE-Meta: U2FsdGVkX1+J7akadx4TRnkWgqV7nMHBYJ4hQXSU4CkynLKczx+6DfOTnglnQDrhb/RuReMZRPnHKNl6bfjX0TLgd2Au1CpANqLAPLBgJNaB/ZVZepX9ryYf1sgOjmigh2rpHZUr3gmhr5jaKS07ZsG8rVWBAKCUe6JMtqmquDb0ZDRlmM9g1ww///oTRY9c56pTckvKyoAmRNyqsGCmQn4dChuLyONQR0+Pkmg6/cIUSSKWV8JAc5uQScT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zMeYLVwcyzNVngb7GqsiosEH+b3duQEX0j6x0HMb2BvuOa6HOl9nfiV8LcY9eSBsWbYje5wmAA 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: List-Subscribe: List-Unsubscribe: Hi Honggyu, On Sun, 17 Mar 2024 17:36:29 +0900 Honggyu Kim wrote: > Hi SeongJae, > > Thanks for the confirmation. I have a few comments on young filter so > please read the inline comments again. > > On Wed, 12 Mar 2024 08:53:00 -0800 SeongJae Park wrote: > > Hi Honggyu, > > > > > > -----Original Message----- > > > > From: SeongJae Park > > > > Sent: Tuesday, March 12, 2024 3:33 AM > > > > To: Honggyu Kim > > > > Cc: SeongJae Park ; kernel_team > > > > Subject: RE: Re: [RFC PATCH v2 0/7] DAMON based 2-tier memory management for CXL memory > > > > > > > > Hi Honggyu, > > > > > > > > On Mon, 11 Mar 2024 12:51:12 +0000 "honggyu.kim@sk.com" wrote: > > > > > > > > > Hi SeongJae, > > > > > > > > > > I've tested it again and found that "young" filter has to be set > > > > > differently as follows. > > > > > - demote action: set "young" filter with "matching" true > > > > > - promote action: set "young" filter with "matching" false > > > > > > > > DAMOS filter is basically for filtering "out" memory regions that matches to > > > > the condition. Hence in your setup, young pages are not filtered out from > > > > demote action target. > > > > > > I thought young filter true means "young pages ARE filtered out" for demotion. > > > > You're correct. > > Ack. > > > > > > > > That is, you're demoting pages that "not" young. > > > > > > Your explanation here looks opposite to the previous statement. > > > > Again, you're correct. My intention was "non-young pages are not ..." but > > maybe I was out of my mind and mistakenly removed "non-" part. Sorry for the > > confusion. > > No problem. I also think it's quite confusing. > > > > > > > > And vice versa, so you're applying promote to non-non-young (young) pages. > > > > > > Yes, I understand "promote non-non-young pages" means "promote young pages". > > > This might be understood as "young pages are NOT filtered out" for promotion > > > but it doesn't mean that "old pages are filtered out" instead. > > > And we just rely hot detection only on DAMOS logics such as access frequency > > > and age. Am I correct? > > > > You're correct. > > Ack. But if it doesn't mean that "old pages are filtered out" instead, It does mean that. Here, filtering is exclusive. Hence, "filter-in a type of pages" means "filter-out pages of other types". At least that's the intention. To quote the documentation (https://docs.kernel.org/mm/damon/design.html#filters), Each filter specifies the type of target memory, and whether it should exclude the memory of the type (filter-out), or all except the memory of the type (filter-in). > then do we really need this filter for promotion? If not, maybe should > we create another "old" filter for promotion? As of now, the promotion > is mostly done inaccurately, but the accurate migration is done at > demotion level. Is this based on your theory? Or, a real behavior that you're seeing from your setup? If this is a real behavior, I think that should be a bug that need to be fixed. > To avoid this issue, I feel we should promotion only "young" pages after > filtering "old" pages out. > > > > > > > > I understand this is somewhat complex, but what we have for now. > > > > > > Thanks for the explanation. I guess you mean my filter setup is correct. > > > Is it correct? > > > > Again, you're correct. Your filter setup is what I expected to :) > > Thanks. I see that it works fine, but I would like to have more > discussion about "young" filter. What I think about filter is that if I > apply "young" filter "true" for demotion, then the action applies only > for "young" pages, but the current implementation works opposite. > > I understand the function name of internal implementation is > "damos_pa_filter_out" so the basic action is filtering out, but the > cgroup filter works in the opposite way for now. Does memcg filter works in the opposite way? I don't think so because __damos_pa_filter_out() sets 'matches' as 'true' only if the the given folio is contained in the given memcg. 'young' filter also simply sets 'matches' as 'true' only if the given folio is young. If it works in the opposite way, it's a bug that need to be fixed. Please let me know if I'm missing something. > > I would like to hear how you think about this. > > > > > > > > > Then, I see that "hot_cold" migrates hot/cold memory correctly. > > > > > > > > Thank you so much for sharing this great news! My tests also show no bad > > > > signal so far. > > > > > > > > > > > > > > Could you please upload the "damon_folio_mkold" patch to LKML? > > > > > Then I will rebase our changes based on it and run the redis test again. > > > > > > > > I will do that soon. > > > > > > Thanks a lot for sharing the RFC v2 for DAMOS young filter. > > > https://lore.kernel.org/damon/20240311204545.47097-1-sj@kernel.org/ > > > > > > I will rebase our work based on it and share the result. > > > > Cool, looking forward to it! Hopefully we will make it be merged into the > > mainline by v6.10! > > I hope so. Thanks for your help! > > Honggyu Thanks, SJ