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 F0BDFC04FFE for ; Fri, 17 May 2024 08:53:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C5076B007B; Fri, 17 May 2024 04:53:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1756A6B0083; Fri, 17 May 2024 04:53:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03D4B6B0085; Fri, 17 May 2024 04:53:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D845C6B007B for ; Fri, 17 May 2024 04:53:17 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 589081C016D for ; Fri, 17 May 2024 08:53:17 +0000 (UTC) X-FDA: 82127273634.23.DE32157 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf27.hostedemail.com (Postfix) with ESMTP id 5784840021 for ; Fri, 17 May 2024 08:53:14 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=II69voSS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of yorha.op@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=yorha.op@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715935994; 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=vUnKK06+m9zxF848R1qs8HU2+D2Pu7/Qze/DSdxTlEg=; b=s8AgwwTrqz5nml3DQd4eCnKr4dEA1qcrRE/+92gjJXuDx01SwN9y6mJY1xAndMfui61Eq1 3i1nG6V6PcWctz9K+QU6HVMUOyM+53yTrYtAj1MDFA19J0SsKWQnrAuJ5Qb4yWONiogbYB vNN6fJ7fHfSpNNLBecB+YBgJYF1IdL4= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=II69voSS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of yorha.op@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=yorha.op@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715935994; a=rsa-sha256; cv=none; b=4UUdvohY0lWfuSgEMoosbQ7SHOYroXF3OyD9+jmxLHI13gVuiP9R9grVcNyvA+Npkjl59e lRo2rrTVXPtvhX36kfCOBvZuosSj2Ync3t0pEiXGQD7ieuLGKWXsgKEc2av9yWW6nvjKcv WMTkfg2ppmjkXIsaDrN3qLbKHOKCX3U= Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-51f174e316eso417545e87.0 for ; Fri, 17 May 2024 01:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715935992; x=1716540792; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vUnKK06+m9zxF848R1qs8HU2+D2Pu7/Qze/DSdxTlEg=; b=II69voSSNIhXZA071WC3bFfmlQ1Wh17TYI87tXnhaSnwxaVa90uKftjyYZoDfluWwx 58eD8Tgy64aiMzAyhBgmoTBxXUt3buntlVC6vAfcrUTv2FisPbW8wUJOuxVC9gexgppC xqrXBUfdvhdJCIpekOuDyLqeCiNQYzqH5+kNZFkJlo3VSBDeXFa5ZZHx2i322WnDA2YE qSa1yrQR/03mCJXpjz52ntPJDxSWWe2Ssh9JX0Sj31YIKxp1FZZP9IuJwhPNONYJ0V9P RNcUI02TDD5SaV/88gGhxzCH4YWy8gIqGMlSdPi67afDBRHiz4TuXKIj6qjasSUfLPrd 9dUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715935992; x=1716540792; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vUnKK06+m9zxF848R1qs8HU2+D2Pu7/Qze/DSdxTlEg=; b=ky+ijx9pVNG9/sjZEBI1vawiccNF2ezXeyngEN3q2m+med4q3KxAR/kJI/wwyDQ7Fj Pv6XLKfJ6Te0L20JEgPUvEGfI6S+HRJQdgTiCDMox1dnca9lL1vZrF1ckPYzLPes+7lr ep6prOCTOFAOYCIIee25n3eOc6daaJ16eXv+p69s50EvgB5a9epBvZDui3McCYe+KEZz 1NkSCYgIzV12oxHy4UJiCTvYaavYpUB/k6sHphABbyK3ivahy3AgDTDF29WKsAint2Vy wOcVFXvURFwngGoVTwzBID+AuvTQFnJiYCg0nvXsRPLfPzJuBg8prB04pw44T+SWJjgC sXSw== X-Forwarded-Encrypted: i=1; AJvYcCUFHg69KMliIt9WCQrJgOsWowBBXMj/QQCwYnJ/m1xNyN7wh02BD4GRewKYB4nS3vpLn2qxq2XerCvyOgv9cIccunI= X-Gm-Message-State: AOJu0YwyK2RECA1yxBXHfp0T00KcP2Z10KTGX77nxnFxj6IRDewljTUN aMnULzSEA2fKcTsjWDRiPvwn0yxSHkGU8wb8AAufnS/76VxgDLC1 X-Google-Smtp-Source: AGHT+IGUGh68rD9VDYg5VoPspmITc/Dg5WaWIbDgsVs4E0iJoDyb8ifLul6q44yypgR7DR/ARf//Lw== X-Received: by 2002:a05:6512:2003:b0:51e:25d2:453f with SMTP id 2adb3069b0e04-5220ff72f1dmr10395650e87.68.1715935992194; Fri, 17 May 2024 01:53:12 -0700 (PDT) Received: from localhost.localdomain ([176.59.160.194]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f39d2c8fsm3209359e87.279.2024.05.17.01.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 01:53:11 -0700 (PDT) From: Alex Rusuf To: sj@kernel.org Cc: damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, yorha.op@gmail.com Subject: Re: [RFC PATCH v1 0/7] DAMON multiple contexts support Date: Fri, 17 May 2024 11:51:51 +0300 Message-ID: <20240517085151.630844-1-yorha.op@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240516221735.82564-1-sj@kernel.org> References: <20240516221735.82564-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 5784840021 X-Stat-Signature: iorcata5eowwog6pf18yf48c59bm1qkw X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1715935994-988176 X-HE-Meta: U2FsdGVkX1/ea5EN8+or1dX5ySVMdxIKOUvZQgR1Nblm9MYc//EE5gp7idJ/IVxIv+ty39WjHPe7JLo7gRue67xxBxL8nJBqieY7+xfYj9/lpgHik30c/ZiEMsvQor5y7uyjWr1vWgaGyN3PtGdWfZgTEm+m0nW2vnwmEkdETJ021JmBOYyYPx7RPjSALMvWBsB7fIOObXT+xw2nqsQoqfYkCVYt/I6bElB4emaekeXpzi6abkcHVTC7QIAttamdcpTDhNGCoqFIIAWwBSNL/A3HRd9bXQwX6d/yXtKKS4Tmz9FvMY8koIVItgJdANEcXPnQol2LNbj/do3pTI9nkoruC8BQwpX/jTw0iZFVBpn9pSfnvsuhh+9FWY+jTH8ew3CYlpAKROTkLPJr6A/zaHm+MwnwW8OcMHTO3bKO28lybHC3lk5F48ww7D8pwGrvLRJB9tm96ypzNvYm7MFFsACUL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vG/JwDNUCofiacVjZaseKmOvZv4/UeKhMkElXu7qQhA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000971, 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 SJ > Hello Alex, > > > Adding high level comments first. I will try to read each patch and add > detailed comments to those as soon as I get some time. > > Also, please Cc linux-mm@ for DAMON patches. I'd also recommend cc-ing > linux-kernel@. Thank you for clarification, I'll add them! > > On Wed, 15 May 2024 18:24:50 +0300 Alex Rusuf wrote: > > Currently kdamond uses only one context per kthread > > and most of its time it sleeps, so utilizing several > > contexts can scale kdamond and allow it to use > > another set of operations. > > Thank you for this patchset. I believe this change is important for DAMON's > long term vision. > > A quick question for a clarification and proper prioritization, though, > since size of this patch series is not very tiny. Does this patch series > is for your real usage? If so, could you please clarify your usage and how > this patch series can help? No, this is not for some commercial use or so that I could describe. It is rather just a RFC, because I'm even not sure how much this can help in real use cases. > > > This patch-set implements support for multiple contexts > > per kdamond. > > > > In pseudo code previous versions worked like > > > > the following: > > while (!kdamond_should_stop()) { > > > > /* prepare accesses for only 1 context */ > > prepare_accesses(damon_context); > > > > sleep(sample_interval); > > > > /* check accesses for only 1 context */ > > check_accesses(damon_context); > > > > ... > > > > } > > > > With this patch kdamond workflow will look > > > > like the following: > > while (!kdamond_shoule_stop()) { > > > > /* prepare accesses for all contexts in kdamond */ > > damon_for_each_context(ctx, kdamond) > > > > prepare_accesses(ctx); > > > > sleep(sample_interval); > > > > /* check_accesses for all contexts in kdamond */ > > damon_for_each_context(ctx, kdamond) > > > > check_accesses(ctx); > > > > ... > > > > } > > The overall idea makes sense to me. > > > To try this you can use modified kernel[1] and > > damo[2]. I also have written few simple shell scripts[3] > > to collect data for damo. > > > > [1] https://github.com/onlyoneofme/damon-multi-contexts.git > > [2] https://github.com/onlyoneofme/damo/tree/multi-contexts > > Looking forward to the patch for DAMO be submitted, or PR-ed! Sure, I will submit a PR for DAMO later. I supported only 'record' and 'report heats' commands, so others haven't touched, that's why I decided to post it there (because it is not ready). > > > [3] https://github.com/onlyoneofme/damon-multi-contexts-tests.git > > Do you have a plan to integrate this into DAMON selftests or damon-tests? Not in the form they are for time being. These are just simple shell scripts that set up kdamond to use multiple contexts and these scripts only collect information like DAMO (but only as perf.data). Anyway, I think we can integrate them with damon-tests with some modifications to be able to actually _test_ if multiple contexts work. As for DAMON selftests, I didn't touch them for time being, so they truly need to be modified and expanded, but before doing that I would like you to look at implementation first, because changes in implementation could affect selftests, so once we agree on that I will implement selftests. Also note, that I didn't integrate changes with debugfs. I remember this is deprecated interface, but I'm not sure if compatibility need to be preseved with it, so do we need to expand debugfs for this? > > > Alex Rusuf (7): > > mm/damon/core: kdamond_struct abstraction layer > > Let's make the subjects clear what it does. For example, this patch's > subject could be "add kdamonds_struct abstraction layer". Similar comment > for other patches. Also, I think '_struct' suffix of 'kdamond_struct' is > not really needed. Let's remove it if there is no special reason to add > it. Sure, I'll change that in next version, thanks! > > > mm/damon/core: list-based contexts organization > > I think this can be squashed into the first patch? If not, could you please > let clarify? I just tried to separate those patches for them to be as simple as possible (actually I failed at that...), but sure, we can squash them. > > > mm/damon/lru_sort: kdamond_struct abstraction layer > > mm/damon/reclaim: kdamon_struct abstraction layer > > Does these two patches mean lru_sort and reclaim are broken by the first > patch? Let's keep everything unbroken in middle of the patchset, to help > bisect. Yes, they're broken by the first patch, I'll squash them, thanks! > > mm/damon/core: rename nr_running_ctxs -> nr_running_kdamonds > > I think this would also better to be together with the first patch? I know > this does not break something, but makes reading patch bit complex. No problem, thanks! > > > mm/damon/core: multi-context support > > mm/damon/core: multi-context awarness for trace events > > I think these two patches should be squashed into one patch. Otherwise, the > trace point is broken in the middle of the patch series, right? You're right, I'll squash them, thanks! > > > include/linux/damon.h | 48 +++- > > include/trace/events/damon.h | 14 +- > > mm/damon/core.c | 497 +++++++++++++++++++++-------------- > > mm/damon/lru_sort.c | 31 ++- > > mm/damon/modules-common.c | 35 ++- > > mm/damon/modules-common.h | 3 +- > > mm/damon/reclaim.c | 30 ++- > > mm/damon/sysfs.c | 306 +++++++++++++-------- > > 8 files changed, 629 insertions(+), 335 deletions(-) > > Thanks, > SJ BR, Alex