Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp343333rdb; Mon, 29 Jan 2024 04:14:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdLd0PWprq3SqsIfFYvzH2C5XGHymP85njVAjNFqkvSKMrPBLfVoRFtOzWonpX3iWtm/HZ X-Received: by 2002:a05:6a20:8690:b0:19c:8ef2:df16 with SMTP id k16-20020a056a20869000b0019c8ef2df16mr1489939pze.2.1706530443935; Mon, 29 Jan 2024 04:14:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706530443; cv=pass; d=google.com; s=arc-20160816; b=wndABD/kKKPirogXr3E9m3zKViCIO7jg3tMXmMQHGscgff1gT6Q4leDO5OJ9wMv7Kg 6oC5qVXdSvVks+2MqjsFVo03k4dNE5XVtat43rO3cgBEtEmAnYlzTq8Z7Ww8ctcDKWDi YuS1OIo4VTRf2eUPCx3cKJDkOCgYkf/DAtFPBtU2QgVtoOaSjW1w4ze9IjGW9F2FVBN+ rEPwjBwjaKp6GK+FF7rfILHrKICOU7nGHNB6huw6TNLCFTvlh4vSsqwv3eBO8E46XclP l0j5ioHii62CJDRYeaDJjMOHs7YGUvwKJNewuhohOl6GvAGPrghRt5dqWXhCiwM5REVM 9e1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=hoaRRVJZbpwuRBmsx74Q+sew1YTbfPVtekdObdLjHlE=; fh=rO6UEK2c+qIkaNj5GAPIujG5cQ8IyEKU7Q7cBkGYZ6s=; b=L3/QQ9VJTg/0OgBNA9JFDSsIQxEBhx+aG6PI9eujGWwz1AAl42B6s+u6Z3V7KQAzZp HFqQf7y7gXTJ8jaPffqycyU6/inl2dHU8JNj1kCGxEOvx6TEjb6xWP+gdAXp2cgassuB VP8t5OgnSe7zoYI9rtA1Q1GL6wjYrOdUe+QBOcsgrZkeJmkKMcdLEGZzy+UPzCD2TknK vGQc+wx+JpzUVI8IYdmcsmkwdi+1CsBA+MPbQxRGp9N3RARlZWmcy0wAMlLEFKvpXErK ongvNH4IcYSW3egBP9dAyZysrcPPtCajbyIGpV8bljtwiKdsAyt+AXtEVZyQOZPkjaYf FCCA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PTISgWzx; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-42674-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42674-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id go22-20020a17090b03d600b002904ae35f7esi5598064pjb.137.2024.01.29.04.14.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 04:14:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42674-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PTISgWzx; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-42674-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42674-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8E20F283CE1 for ; Mon, 29 Jan 2024 12:14:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E11F604C9; Mon, 29 Jan 2024 12:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PTISgWzx" Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD5D5604B8 for ; Mon, 29 Jan 2024 12:13:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706530405; cv=none; b=XQ8+4jV9h0SDHQZSuPxUvIAby5oN3lU+V5gEHo/0fy53RKOkxkKPQYZYHjVkmGn04eO1x0ZzSzziZXRODbnHn2vp3qYHhsAxDtP8cV0ymbbsussWbws7EArlGxd20nh7TyDKtrjYXOqWGNPZWimLnvUn6LpYWigyGRQRkxlrLlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706530405; c=relaxed/simple; bh=WLvrHrbgSBFuvT4E7HlrAAw1sNsWn7JBXxbApEH6mhE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=REA3vx9KqQnRxCUlh4dyrfbEZvVguvBDXHpMdsfukbumbAPw90ZgSS2Vev8i0bmhXzqigOZcyaruEHb+nogiGMBmAwY4mnCeTMtcSwSwKP8lkrtgjPLCWNx6MSSzPx+4GDMrYSKKHDeGNaACU1WMC/RPex5gwXyQi5jmbsD4f7o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PTISgWzx; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d8da50bfd9so3077245ad.1 for ; Mon, 29 Jan 2024 04:13:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706530403; x=1707135203; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=hoaRRVJZbpwuRBmsx74Q+sew1YTbfPVtekdObdLjHlE=; b=PTISgWzxBsKKdQOw2Xjf2BD9ijlLC1o1mW8m50l42sJGPHEHkrPHFud0PTHj/XmCUp X9C+idBG4yUYOAORQp8HieTBxfWnS8OZN7OkraLFZTsPDjs/8GP2tMvD3FnkqP7AY3i8 z+A5QJaChkoFPIKIHIi1MrfKkjfLqbW6gAK1MjsRyL+5+Qo2Ju/dxVVb0usZVTf5B1ZV RQBOrJSiDvzBrQSKu4bGz1rogX3+jhUAHzaV/iFCZoeW3ldfw2oKybmIqMUegm24ovku ngQ0DVJi8ZKbGYP511lDiyU0j75Ee/fYk4EZCcqeiYha24EIxCIfL1Ek/uLOqaUqGmnl vlAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706530403; x=1707135203; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hoaRRVJZbpwuRBmsx74Q+sew1YTbfPVtekdObdLjHlE=; b=mAqAw4L2q0e+kQrRg1YE/ypoasOxX6nADJEkpwW8otC8qqmhZWok+SxEnMTJA3owXh onOnprCfRqJ9TeKU+0wEEoqasfeUfzG1e5Ph0YWj2z9I3wDJ2EROb6trow8U0hYBevr5 wYqjnEA3RYRPESwMVTWkcw+V2D1yRCL2v+kt15kpCHLrd1EcVhCAekLpAeuJqbNWCPCF PswsYsCUu+1KlVfZWmS6oAVzKmpI5FKEIJDI8oE/ZZpZNj3038gzHXdBo0B9sWk3P+4w tfLUAmqXIE0X9iJEQFE3KJ/jZJ4ddhB37xRNImDD3ELhZutZSMG9D+2uJplhj15AAJlB gA2g== X-Gm-Message-State: AOJu0YyOn4Sj5Sv+Cw8Mbxuz7SS2YDkxjB+GRYxdS43nCIqerfGzx2Jv oMiWh1pnHmm5rpxnIKHIevyVx4neHNagPpTkKgdrdNWKsBvNT7I2gMfiED5u X-Received: by 2002:a17:902:6804:b0:1d4:e04b:4742 with SMTP id h4-20020a170902680400b001d4e04b4742mr2117030plk.58.1706530403008; Mon, 29 Jan 2024 04:13:23 -0800 (PST) Received: from cuiyangpei ([43.224.245.227]) by smtp.gmail.com with ESMTPSA id s10-20020a170902ea0a00b001d714a1530bsm5242067plg.176.2024.01.29.04.13.20 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jan 2024 04:13:22 -0800 (PST) Date: Mon, 29 Jan 2024 20:13:16 +0800 From: cuiyangpei To: SeongJae Park Cc: akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, xiongping1@xiaomi.com Subject: Re: [PATCH 1/2] mm/damon/sysfs: Implement recording feature Message-ID: <20240129121316.GA9706@cuiyangpei> References: <20240128162804.17866-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240128162804.17866-1-sj@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) On Sun, Jan 28, 2024 at 08:28:04AM -0800, SeongJae Park wrote: > On Sun, 28 Jan 2024 17:13:00 +0800 cuiyangpei wrote: > > > On Fri, Jan 26, 2024 at 12:04:54AM -0800, SeongJae Park wrote: > [...] > > > So, 'update_schemes_tried_regions' command is firstly handled by > > > 'damon_sysfs_cmd_request_callback()', which is registered as > > > after_wmarks_check() and after_aggregation() callback. Hence > > > 'update_schemes_tried_regions' command is still effectively working in > > > aggregation interval granularity. I think this is what you found, right? > > > > > Yes. > > > If I'm not wrongly understanding your point, I think the concern is valid. I > > > think we should make it works in sampling interval granularity. I will try to > > > make so. Would that work for your use case? > > > > > It's much better than working in aggregation interval. > > Thank you for confirming. I will start working on this. > Great, looking forward to seeing the progress. > > > > I have a question. Why does the 'update_schemes_tried_regions' command need to work > > in the sampling time or aggregation time? 'update_schemes_tried_regions' is a > > relatively special state that updates the regions that corresponding operation scheme. > > Can it be separated from other states and controlled by sysfs node to respond immediately > > after being written? > > Mainly because the region data is updated by a kdamond thread. To safely > access the region, the accessor should do some kind of synchronization with the > kdamond thread. To minimize such synchronization overhead, DAMON let the API > users (kernel components) to register callbacks which kdamond invokes under > specific events including 'after_sampling' or 'after_aggregate'. Because the > callback is executed in the kdamond thread, callbacks can safely access the > data without additional synchronization. DAMON sysfs interface is using the > callback mechanism, and hence need to work in the sampling or aggregation > times. > Thank you for the detailed explanation. > Thanks, > SJ > > [...]