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 29F12C54E60 for ; Sun, 17 Mar 2024 19:14:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9997F6B007B; Sun, 17 Mar 2024 15:14:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 949E96B0082; Sun, 17 Mar 2024 15:14:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 811046B0083; Sun, 17 Mar 2024 15:14:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6E7D16B007B for ; Sun, 17 Mar 2024 15:14:10 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C10E2120709 for ; Sun, 17 Mar 2024 19:14:09 +0000 (UTC) X-FDA: 81907481418.22.E19F28C Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf05.hostedemail.com (Postfix) with ESMTP id A00E810001E for ; Sun, 17 Mar 2024 19:14:06 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pe62biVs; spf=pass (imf05.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710702847; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=32zj5+e2e8uu2buY3BeEwADpqnip+LTX09G81Cvi/vE=; b=o4t+izja1c+8mUZygj7UWvWO8IsE9xqlMi43xoF4T/z2XwxzMOMp2TgVXKFCIaQcZaH5p3 rgh31hQ867vsU4F9EVFfsO7NpH3CyCyTIyGmJOYAibt0+UrncjGd/YHUnNWH6waEC8qa6E qdq3CirQJDuMuxfNgcHEuFemIfmJmrA= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pe62biVs; spf=pass (imf05.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710702847; a=rsa-sha256; cv=none; b=AtJLDfZhl4KEneAAZbdqpwZT8mOXPQ8OGRJNIGDB3U5U3ERBrPMLpm9hI4FbL5svbPsx8d CTZHAw4Vespg3k3/+Oc498FMSQk0KFkLvu7tR0ci0YhBCQsF1hkqyhSA5SFWC1WJDRD5wH yqDxxKH9mnMnqRGBw3BhfnU4tsX6Tic= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C35DACE0920; Sun, 17 Mar 2024 19:14:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5440CC433C7; Sun, 17 Mar 2024 19:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710702841; bh=qY5H5aIaYNBa2SChjq9AE3ktByIG3xpixgbmma9+RHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pe62biVsZkBTkvbUQpee9lM3WG3P0ngQ0Top+3fv4wE3pY1WJI5kDpORwcJ8NVgj5 sZW4TanLoLCgUjP5yDwFkKmZYE6Q519CiGmPlNdT0sBTVN6mzw15bFxcztd2mivRj8 VxHDDBh7x2Zzd/raY+tTJiNQo2EZGM1msOsZEqONHSuLawsqTtLZuByX6mSRHQ4HgK 9JsI+GNewoGU1DVf0Yp6usbuRr32YMrATBfCdfdhWaLaioUBGVgGwe4pUpD1nVr4BC u1381u/qat4xU37yJfbORWJwO2x4A0Vvc5MQlKfXZYGlMk3lUOv0T6lEQWpiSsNeaR RIQq4W5TNFtTw== From: SeongJae Park To: SeongJae Park Cc: Honggyu Kim , 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 12:13:57 -0700 Message-Id: <20240317191358.97578-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240317153144.11931-1-sj@kernel.org> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A00E810001E X-Rspam-User: X-Stat-Signature: m3h7zkrdjysojisb7nifk5buohogi9b1 X-Rspamd-Server: rspam01 X-HE-Tag: 1710702846-302374 X-HE-Meta: U2FsdGVkX18RtIyE/cNaKexfrPtMXmPELtoHByHCy6N+WN1dZqQ3YDQg0t3u58TKDB+fj/VhimWKpQOxHnMvlTkc7RoMlemonMaVTANJoeJL2zmRlmp3wjkuptkh9MqRZoGNrltI9YHbRwigvPRkdv5UXnaPxlHIGvaN/L8X8c+tMdEHN8ISVqhU5DLiGDme7qq5JQpqPNRsua0GEf0laUeBAfFMxBiOiOgKCsCEFvxbNob//jhbsPVJMN9cPqkMGYKiTuM5LA/s/92sGVCl38uGQrhOHkExJP4W9IKINGW3IbwdpaLwDwEHa7gk1XDIzSUfRMrPsUfaaZZ5KVRTnrvy9+Ar0O3Epm6gxq3vMR53YpE1g/RmL/rd6Z2TXH86DI7dT9fiWP6QjjlhmktjhTaIdbUTs3sQF4A3Kvp6fjy4Q4ut0izF/+r3W6IbXQm6R27qRA9H8mea8N3pHFlFEA2HZkilKC7yrCdIM4NZ7qLkN2c/OkcuKa/rvNEpPzRoLllWiwK0mHYD8Vw3ISjcPVkYL4LPx391wx1IypCX1DWqfJQesKUpOaJG8d4w7XD7JgAYAxfc51r4WrZLIKZ6pjtZ2retMEUIwH3UbqiJvSQHDXQcz9FuZjaTDAqyz3mo28M+AtspKBzybzC0Yrxvtot9pnToHgeIpB1/+YG4IEYZeMu22gHfb3L11i5oYxrHMAFoAm5UjRAp2kYV2B9vrm5vUagVXXGu0B1cEqIVGr+ivwlndRbJHSil0c2NHhxBHD7VCqlpnMdm3ugVDOBaJALz1T+H1PJ7ggavgvOuPfkd9yogJ6FOGNml6ok4GhWNeWgD/knHzNhn9Gjcs7BqRwEpuBXmnHhkm4kpXo6LEhGF/eeh/vYsxqelGnKucoX3k9Zer8FOxw6GE+hgdJneV7ikF75B/SvTqmf8/BWCceUF1MOGx2RU5RZiYbWqx/axe3c9ZND3o1inNevQJWb +dQaHbV2 BKyyxpF0fBVJQzTt7cakSrT2wWw== 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: On Sun, 17 Mar 2024 08:31:44 -0700 SeongJae Park wrote: > 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, [...] > > 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 just read the DAMOS filters part of the documentation for DAMON sysfs interface again. I believe it is explaining the meaning of 'matching' as I intended to, as below: You can write ``Y`` or ``N`` to ``matching`` file to filter out pages that does or does not match to the type, respectively. Then, the scheme's action will not be applied to the pages that specified to be filtered out. But, I found the following example for memcg filter is wrong, as below: For example, below restricts a DAMOS action to be applied to only non-anonymous pages of all memory cgroups except ``/having_care_already``.:: # echo 2 > nr_filters # # filter out anonymous pages echo anon > 0/type echo Y > 0/matching # # further filter out all cgroups except one at '/having_care_already' echo memcg > 1/type echo /having_care_already > 1/memcg_path echo N > 1/matching Specifically, the last line of the commands should write 'Y' instead of 'N' to do what explained. Without the fix, the action will be applied to only non-anonymous pages of 'having_care_already' memcg. This is definitely wrong. I will fix this soon. I'm unsure if this is what made you to believe memcg DAMOS filter is working in the opposite way, though. Thanks, SJ [...]