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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BA24C433F5 for ; Fri, 22 Oct 2021 09:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D4536105A for ; Fri, 22 Oct 2021 09:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232515AbhJVJqE (ORCPT ); Fri, 22 Oct 2021 05:46:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:54336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbhJVJqD (ORCPT ); Fri, 22 Oct 2021 05:46:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A737B610EA; Fri, 22 Oct 2021 09:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634895826; bh=dReKDaKJwqW3Io2bve4J9VXECU2Jr66ov+QZ5vpHXXE=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=TAzoAt/+5wohwJmdHC32vbbltcslPkFnm0pw8jVFs8mGVLs0IRWuz5/AZMR+PAJlm r+WgFzNJ1bvzBWZw3i0xydoJrXpqN0F8Md7NqXQHiyyztIqEHw7I+0MgjbAdyhuZEA 58uzEIFDBVZ2MaxhK79HgArwGhRkZ793G/Ll5NqsW+lZD0DdiAWaAgI7nXvGoynXW6 GPADNCSOcAd2rnfcPZ2jWSjEocw3dnzbfgzaL86f7Efty6m5fx4807i586B8n7KHrA +3o0KT1CN9li14SArDyMGMRqkKlAv/o+jCjxmmHthKPVVdRq+z0e2T36IuVWkHMjo0 Se1J5PFvctiEg== From: SeongJae Park To: Xin Hao Cc: SeongJae Park , sjpark@amazon.de, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] mm/damon/dbgfs: Optimize target_ids interface write operation Date: Fri, 22 Oct 2021 09:43:41 +0000 Message-Id: <20211022094341.3966-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Oct 2021 10:43:22 +0800 Xin Hao wrote: > > On 2021/10/22 上午1:30, SeongJae Park wrote: > > Hello Xin, > > > > On Fri, 22 Oct 2021 00:44:16 +0800 Xin Hao wrote: > > > >> When we want to clear previously set target ids, > >> For example, it works as below now: > >> # echo 42 > target_ids > >> # cat target_ids > >> 42 > >> # echo > target_ids > >> # cat target_ids > >> > >> But in 'dbgfs_target_ids_write', there is no need to > >> execute other codes, except call 'damon_set_targets' > >> to clear previously set target ids. So there adds > >> the 'nr_targets' judgment, if the value is 0, just > >> call 'damon_set_targets', and then return. > > It's true that it executes some unnecessary code. However, I unsure if that is > > a problem, as the code that will be additionally executed in this case are > > quite simple ones, and therefore not supposed to incur viewable overhead. > > After all, this is not a performance critical path. > > Thank you for your detailed explanation. I may not describe it clearly, > making you think that i am making this > > modification to improve performance,I just want to avoid irrelevant code > execution, thank you so much. I guess I didn't make my point clear enough, sorry. My concern in this patch is the fact that it is adding more code. IMHO, as the code is already working correctly and benefit of this change is quite subtle as you also agreed, adding the code here doesn't seem worthy but only making it harder to maintain, to me. If I'm missing something, please let me know. Thanks, SJ [...]