mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Su Hui <suhui@nfschina.com>
To: Dave Martin <Dave.Martin@arm.com>,
	Dan Carpenter <dan.carpenter@linaro.org>
Cc: tony.luck@intel.com, reinette.chatre@intel.com,
	james.morse@arm.com, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] fs/resctrl: using guard to simplify lock/unlock code
Date: Tue, 24 Jun 2025 10:46:24 +0800	[thread overview]
Message-ID: <cf505dc6-c123-44fd-9ee6-5aac4764f905@nfschina.com> (raw)
In-Reply-To: <aFlvTt+GGSIqgOKH@e133380.arm.com>

On 2025/6/23 23:14, Dave Martin wrote:
> Hi,
>
> On Mon, Jun 23, 2025 at 07:25:41PM +0800, Su Hui wrote:
>> Using guard() to replace *unlock* label. guard() is better than goto
>> unlock patterns and is more concise. No functional changes.
>>
>> Signed-off-by: Su Hui <suhui@nfschina.com>
> How were these cases chosen?
I chosen the code  that match with "*unlock*:" label.
>
> I notice that this patch only handles some straightforward mutex_unlock()
> cases.  There are other opportunities in some places -- particularly
> alloc/free patterns.
Yes, as Dan mentioned[1], there are too many these patterns and I'm not 
sure how
much value we can get to do this things. This patch is a try that using 
guard() to
remove some  lock/unlock pattern and simplify the lock code.
> Overall, I'm not totally convinced that backporting the guard()
> infrastructure into code that wasn't originally written to use it is
> always worthwhile.
>
> If the code is simple, there is not much benefit.  Otherwise, there is
> a significant chance of unintentionally changing the behaviour of the
> code (though the exercise may be useful if it identifies actual bugs).
>
> Either way, such changes will get in the way of people who are rebasing
> on top of this code.
Got it, it's ok to omit this patch. It seems this patch has not enough 
value.
> FWIW, this patch looks OK though, and the diffstat looks reasonable.
> Since this code was recently moved into fs/, diff context noise may be
> less of a concern.
Maybe only for some complex lock/unlock code, guard() can bring some value.
Thanks for your advice!

[1] 
https://lore.kernel.org/all/d07fe2d9-3548-43fc-b430-2947eee3145b@suswa.mountain/

Regards,
Su Hui



  reply	other threads:[~2025-06-24  2:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 11:25 Su Hui
2025-06-23 15:11 ` Dan Carpenter
2025-06-23 15:14 ` Dave Martin
2025-06-24  2:46   ` Su Hui [this message]
2025-06-24 14:27     ` Dave Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf505dc6-c123-44fd-9ee6-5aac4764f905@nfschina.com \
    --to=suhui@nfschina.com \
    --cc=Dave.Martin@arm.com \
    --cc=dan.carpenter@linaro.org \
    --cc=james.morse@arm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®