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 3F080C433EF for ; Wed, 10 Nov 2021 15:35:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D035D6121F for ; Wed, 10 Nov 2021 15:35:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D035D6121F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4D8F66B006C; Wed, 10 Nov 2021 10:35:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 488136B0071; Wed, 10 Nov 2021 10:35:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 376F46B0072; Wed, 10 Nov 2021 10:35:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 289A56B006C for ; Wed, 10 Nov 2021 10:35:49 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DBCE11844AD03 for ; Wed, 10 Nov 2021 15:35:48 +0000 (UTC) X-FDA: 78793420776.29.154991B Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) by imf29.hostedemail.com (Postfix) with ESMTP id 81AB19000274 for ; Wed, 10 Nov 2021 15:35:48 +0000 (UTC) Received: by mail-il1-f176.google.com with SMTP id l8so2930885ilv.3 for ; Wed, 10 Nov 2021 07:35:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jO63MgqvvS2Y6tzvamI38zwEpN79l20A/JLQ6KGTtgo=; b=lZHZ9Optsrfhc9hTh8U009OHE4jBEBHSNssg6xDMRXxXMkYtOvO9OIqwSFm5RO5C7l NhogbK8eX5WiZ6Z0dYMxpUXOE9fzbfMrRv+JPUOoYebq+MhlN9SlQcVyx4PYMwEICkeV LoTIxOVrgKc+IQgG5iizDcbJ58qKQk+QO8TAJ3nCqJLis0QiH8qLSPvRqZvX2/9Al5eR Y77P5T/vqeBxoZS2xnfZYTBKi1mN+yrmFYglvX5Jj8NyAdRIEKCeTJ3p73tMPs90Sws3 +a7v6glyx406fjPyMfNubUevPCZ5kxVMWxcH8Z1TD75Sd/GaHqFpK/3pj99nNoyuwmUG ApVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jO63MgqvvS2Y6tzvamI38zwEpN79l20A/JLQ6KGTtgo=; b=rcCvdr9P88FWKOEHC28driyDGjPEDRtutW8v75FXMQGgGxIlvxEnUba2zSAhfLuAF1 BCqkdEdgPwF7i8S3jUIGVM1ZEwesIhr2afE0nV0EXJ49yrnySyrxSCM6PiUNMWeyI+bY fxy6xToCbtGZcQV9pujMXGfQdnnZNbPwbfAnk5QBmJoqGevZLLsWHZBMvUEmsjT4DxjA hMdeA66QS8i0uklvcq2q0b67PWeKKa74cqu4jHSg4a8pOh6Nn5YtMItqKcYehUkjpVfr 3xfVPPSSVafwksVGTBMSNTcPflzWK5qXXmJAqLrX0ybksmWoFuq5mhFSGGUE/29jmuR1 Nf+w== X-Gm-Message-State: AOAM533sv1eBIsukF1SdoAz9uwLeQDWjMVCrBGeErlPZ3VyniX9EEkKk i3MNfudA+eRNCzrdv7y72Z9ty3ZRGBy8nlK79bw= X-Google-Smtp-Source: ABdhPJxTDb21+xwdqgE4xozl8iy1qBpI9s2Xx1sstlMfMT+1W4dplV0CIHtshP5Am0abkcjqthoC+wqS/lnoYQYtEdU= X-Received: by 2002:a05:6e02:2149:: with SMTP id d9mr543803ilv.221.1636558547722; Wed, 10 Nov 2021 07:35:47 -0800 (PST) MIME-Version: 1.0 References: <20211110143535.15809-1-sj@kernel.org> In-Reply-To: <20211110143535.15809-1-sj@kernel.org> From: Alex Shi Date: Wed, 10 Nov 2021 23:35:11 +0800 Message-ID: Subject: Re: [RFC PATCH] mm/damon: remove damon_lock To: SeongJae Park Cc: Alex Shi , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 81AB19000274 X-Stat-Signature: 8b8fqbqz8uhk13k9rr1dsh1piuwkzkdy Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lZHZ9Opt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of seakeel@gmail.com designates 209.85.166.176 as permitted sender) smtp.mailfrom=seakeel@gmail.com X-HE-Tag: 1636558548-487609 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: On Wed, Nov 10, 2021 at 10:35 PM SeongJae Park wrote: > Yes, it would effectively avoid the problem case. However, I'm unsure how much > performance gain this change is providing, as apparently the lock is not being > used in performance critical parts. > > I'm also unsure if this change is reducing the complexity of the code or not. > For an example, this change allows someone to show non-zero nr_running_ctxs > while no real kdamond is running, before __damon_start() is called, or when it > failed. I think this would never be a real issue, but might make my poor brain > a little bit confused when debugging. > > Also, we might add some more variables and code section that should be mutually > exclusive to concurrent DAMON users in future. > > atomic_t is obviously enough for protecting a variable. But, IMHO, it might > not necessarily be the best choice for non-performance-critical mutex sections. > > Please feel free to let me know if I'm missing something. > hi SJ, Thanks for the quick reply! Yes, it's fine to use mutex on a slow path, it won't cost much. but I just feel itchy while looking at the code, especially since it only guards an int... Anyway, it's up to you. Thanks Alex