All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Siddh Raman Pant <code@siddh.me>
Cc: christophe.jaillet@wanadoo.fr, corbet@lwn.net,
	dhowells@redhat.com, edumazet@google.com,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org, mchehab@kernel.org,
	rdunlap@infradead.org
Subject: Re: [PATCH v2 3/3] kernel/watch_queue: Remove wqueue->defunct and use pipe for clear check
Date: Fri, 5 Aug 2022 00:24:31 -0700	[thread overview]
Message-ID: <YuzFrzrTnTtUHMn/@sol.localdomain> (raw)
In-Reply-To: <20220804144152.468916-1-code@siddh.me>

On Thu, Aug 04, 2022 at 08:11:52PM +0530, Siddh Raman Pant wrote:
>  static inline bool lock_wqueue(struct watch_queue *wqueue)
>  {
>  	spin_lock_bh(&wqueue->lock);
> -	if (unlikely(wqueue->defunct)) {
> +	if (unlikely(!READ_ONCE(wqueue->pipe))) {
>  		spin_unlock_bh(&wqueue->lock);
>  		return false;
>  	}

Why is the READ_ONCE() needed?  Doesn't wqueue->lock protect wqueue->pipe?

> +	/* This pipe will get freed by the caller free_pipe_info().
> +	 * Removing this reference also prevents new notifications.
> +	 */

This isn't the correct block comment format; it should look like:

	/*
	 * This pipe will get freed by the caller free_pipe_info().
	 * Removing this reference also prevents new notifications.
	 */

- Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Siddh Raman Pant <code@siddh.me>
Cc: corbet@lwn.net, rdunlap@infradead.org,
	linux-kernel@vger.kernel.org, dhowells@redhat.com,
	edumazet@google.com, christophe.jaillet@wanadoo.fr,
	mchehab@kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH v2 3/3] kernel/watch_queue: Remove wqueue->defunct and use pipe for clear check
Date: Fri, 5 Aug 2022 00:24:31 -0700	[thread overview]
Message-ID: <YuzFrzrTnTtUHMn/@sol.localdomain> (raw)
In-Reply-To: <20220804144152.468916-1-code@siddh.me>

On Thu, Aug 04, 2022 at 08:11:52PM +0530, Siddh Raman Pant wrote:
>  static inline bool lock_wqueue(struct watch_queue *wqueue)
>  {
>  	spin_lock_bh(&wqueue->lock);
> -	if (unlikely(wqueue->defunct)) {
> +	if (unlikely(!READ_ONCE(wqueue->pipe))) {
>  		spin_unlock_bh(&wqueue->lock);
>  		return false;
>  	}

Why is the READ_ONCE() needed?  Doesn't wqueue->lock protect wqueue->pipe?

> +	/* This pipe will get freed by the caller free_pipe_info().
> +	 * Removing this reference also prevents new notifications.
> +	 */

This isn't the correct block comment format; it should look like:

	/*
	 * This pipe will get freed by the caller free_pipe_info().
	 * Removing this reference also prevents new notifications.
	 */

- Eric
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2022-08-05  7:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 13:30 [PATCH 0/3] kernel/watch_queue: Clean up some code Siddh Raman Pant via Linux-kernel-mentees
2022-08-04 13:30 ` Siddh Raman Pant
2022-08-04 13:30 ` [PATCH 1/3 v4] kernel/watch_queue: Remove dangling pipe reference while clearing watch_queue Siddh Raman Pant via Linux-kernel-mentees
2022-08-04 13:30   ` Siddh Raman Pant
2022-08-04 13:30 ` [PATCH 2/3] kernel/watch_queue: Improve struct annotation formatting Siddh Raman Pant via Linux-kernel-mentees
2022-08-04 13:30   ` Siddh Raman Pant
2022-08-05  7:22   ` Eric Biggers
2022-08-05  7:22     ` Eric Biggers
2022-08-05  9:35     ` Siddh Raman Pant via Linux-kernel-mentees
2022-08-05  9:35       ` Siddh Raman Pant
2022-08-04 13:30 ` [PATCH 3/3] kernel/watch_queue: Remove wqueue->defunct and use pipe for clear check Siddh Raman Pant via Linux-kernel-mentees
2022-08-04 13:30   ` Siddh Raman Pant
2022-08-04 14:41   ` [PATCH v2 " Siddh Raman Pant via Linux-kernel-mentees
2022-08-04 14:41     ` Siddh Raman Pant
2022-08-05  7:24     ` Eric Biggers [this message]
2022-08-05  7:24       ` Eric Biggers
2022-08-05  9:35       ` Siddh Raman Pant via Linux-kernel-mentees
2022-08-05  9:35         ` Siddh Raman Pant
2022-08-05 18:33         ` Eric Biggers
2022-08-05 18:33           ` Eric Biggers
2022-08-06  7:23           ` Siddh Raman Pant
2022-08-06  7:23             ` Siddh Raman Pant via Linux-kernel-mentees
2022-08-05  7:16 ` [PATCH 0/3] kernel/watch_queue: Clean up some code Eric Biggers
2022-08-05  7:16   ` Eric Biggers
2022-08-05  9:35   ` Siddh Raman Pant via Linux-kernel-mentees
2022-08-05  9:35     ` Siddh Raman Pant

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=YuzFrzrTnTtUHMn/@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=code@siddh.me \
    --cc=corbet@lwn.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rdunlap@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.