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 C18F4C47088 for ; Wed, 30 Nov 2022 23:25:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E9CA6B0071; Wed, 30 Nov 2022 18:25:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 299626B0073; Wed, 30 Nov 2022 18:25:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 189646B0074; Wed, 30 Nov 2022 18:25:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0B9586B0071 for ; Wed, 30 Nov 2022 18:25:04 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D07851C687B for ; Wed, 30 Nov 2022 23:25:03 +0000 (UTC) X-FDA: 80191691286.05.EE6B781 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf17.hostedemail.com (Postfix) with ESMTP id 36B4940004 for ; Wed, 30 Nov 2022 23:25:02 +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 4C186B81D59; Wed, 30 Nov 2022 23:25:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F5B4C433D6; Wed, 30 Nov 2022 23:24:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669850700; bh=gqcFXZHwwBwyWaUhRXSzf2GnKgPLlzaIwX0k3rlJp4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uB6Gy53iThRwFUtXz0Lrt0gouRzm76Xw6GupSl/Il/ITiYN6eZNV0tlhrGqk76arO zKfEYpxEcumW46KA2Rm49M1isUzl2ZNz4Ps1qN1S7oiU598V+ONGImxHZOqdeidcMO BCW2U161XPLpGcBhLDO6e1aA+tjfOBIa4NZVS4ZiR1hDsQcahacrbQ4JKQLCqmNi29 sgIkgb0goTGHi6rvR5gxo3QV+3p3GYpRUTVV+K8Kto07jywH32KmpW7b00f2A1/m/B bZHOhKDUZGg6ieVvPQxtVRCtLkWkusFmdolNJKgvZnTHCHuOkr8DnuiQJTS3OdyFeq /k2l6pkaSMjvA== From: SeongJae Park To: Yun Levi Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, Linux Kernel Mailing List Subject: Re: [Question] Should we reuse target when damon's operation changed? Date: Wed, 30 Nov 2022 23:24:57 +0000 Message-Id: <20221130232457.56003-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uB6Gy53i; spf=pass (imf17.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1669850703; a=rsa-sha256; cv=none; b=ayZTK/L1idVCF+YvOYOe8L1QeVN1EBwG+frr5ipgUn3VBEuib2zJZ3MhFXhcVqDjJMocy0 DGM7u29Hke9TOwYWEyZOBBj97lkdpKMbWxX8lCXCY2qslN+a0m6Aa3xsmizxmez//jlzGd +cT3yJxhqcHyexio+MpiK7tRqO2fFG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669850703; 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=LzYr3AN9ivqfjEXu5kJPaUBKXyI7G4New0Byp1StYqo=; b=aDbXHiB2oVCI8h0Uu5lFFXhUqjU3za+gKAgIXOnHR5jERtKt+GdxX3dBLYPHFgN5vxCYxP f+80xTG1JD/XdKsCZDM/or+TcxVefQ4dW5ORJxNsoCxgZLPprRBh0wKWHxgZAqxsx402PW 4EpsasBHEyUy6QXY7vVLvjbtmTgvib4= Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uB6Gy53i; spf=pass (imf17.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 36B4940004 X-Stat-Signature: nyk3nscxoppm91ozw4d939zn3a4um75j X-Rspam-User: X-HE-Tag: 1669850702-734356 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: Hi Levi, On Wed, 30 Nov 2022 15:01:29 +0900 Yun Levi wrote: > Hello SJ. > > While I try to use damon, I have some questions whether it is correct > to reuse damon_target structure when damon's operation is changed. > > At first, one user set up damon like below. > echo 1 > /sys/kernel/mm/damon/admin/kdamonds/nr_kdamonds > echo 1 > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/nr_contexts > echo 1 > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/targets/nr_targets > echo 1 > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/targets/pid_target > echo 1 > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/targets/regions/nr_regions > echo 0 > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/targets/regions/nr_regions/0/start > echo 16384 > > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/targets/regions/nr_regions/0/end > > echo vaddr > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/operation > echo on > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/state > > And some time pass, user change the operation as "paddr" like below: > echo paddr > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/operation > echo commit > /sys/kernel/mm/damon/admin/kdamonds/0/contexts/0/state > > In that situation, the damon_target is reused and the region isn't changed, > former region information which damon_region has -- nr_accesse, > last_nr_accesss, last_sample addr is kept. > > But, former accessed information is based on vaddr and changed > accessed information should be based on paddr and it seems the wrong > information to new applied operation. > > IIUC, it makes some confusion to kdamond when it merges or splits > regions based on above information. > > So, Is it much better to remove the target and region information when > the operation is changed? or should we check whether it's possible to > reuse former access information between former and new operation? Thank you for the good question and the suggestion. I agree that it could be confusing. Such a scenario could be just a mistake in many cases. However, I'm unsure how we could distinguish the mistake from intended usage. That is, the intended initial monitoring range for previous 'operation' and later one could be really same in some cases, as DAMON doesn't ask it to be strict. After all, DAMON allows users to set the values as much as they want before committing the input, so this looks mistake of the user, not DAMON. Of course DAMON could take care of more things, but in my humble opinion, it's hard to distinguish the mistake from the intended change in a simple way. And I'm not sure if this is a real critical issue that deserves to add some extent of complexity. So unless you know critical issue due to this or have a good way for improving the situation in a simple way, please suggest. If not, I'd suggest to keep this in current simple form. Nevertheless, maybe we could improve this situation by warning this case on the documentation. If you'd like to, please feel free to send a patch for that. Thanks, SJ > > Thanks. > > -- > Best regards, > Levi