mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: YangYang <yang.yang@vivo.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jens Axboe <axboe@kernel.dk>, Omar Sandoval <osandov@fb.com>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH v6] sbitmap: fix io hung due to race on sbitmap_word::cleared
Date: Fri, 12 Jul 2024 10:53:28 -0700	[thread overview]
Message-ID: <293dff44-8ae2-431b-a002-b31a09ddd34e@acm.org> (raw)
In-Reply-To: <CAFj5m9L2qin-h1qfPbhotSr-2Xh+mnQbsWhpzeK3dA_YTQ=JpA@mail.gmail.com>

On 7/11/24 6:01 PM, Ming Lei wrote:
> On Fri, Jul 12, 2024 at 12:33 AM Bart Van Assche <bvanassche@acm.org> wrote:
>> The comment above 'swap_lock' in this patch is as follows:
>>
>>          /**
>>           * @swap_lock: Held while swapping word <-> cleared
>>           */
>>
>> In other words, 'swap_lock' is used to serialize *code*. Using
>> synchronization objects to serialize code is known as an anti-pattern,
>> something that shouldn't be done.
> 
>> Synchronization objects should be used
>> to serialize access to data.
> 
> It can be thought of serializing UPDATE on both ->word and ->cleared,
> instead of code.

It would be appreciated if the comment above swap_lock would be modified
such that it reflects that it serializes simultaneous updates of ->word
and ->cleared.

Thanks,

Bart.


      reply	other threads:[~2024-07-12 17:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10  6:56 Yang Yang
2024-07-10 16:41 ` Bart Van Assche
2024-07-11  9:47   ` YangYang
2024-07-10 19:54 ` Bart Van Assche
2024-07-11 12:48   ` YangYang
2024-07-11 13:39     ` Ming Lei
2024-07-11 16:33       ` Bart Van Assche
2024-07-12  1:01         ` Ming Lei
2024-07-12 17:53           ` Bart Van Assche [this message]

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=293dff44-8ae2-431b-a002-b31a09ddd34e@acm.org \
    --to=bvanassche@acm.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=osandov@fb.com \
    --cc=yang.yang@vivo.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®