linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Wang Qing <wangqing@vivo.com>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: rename __prepare_to_swait() to add_swait_queue_locked()
Date: Wed, 17 Mar 2021 06:12:41 +0100	[thread overview]
Message-ID: <284138d64b5010ebe5a6490402dc01d006677dd1.camel@gmx.de> (raw)
In-Reply-To: <1615895969-3376-1-git-send-email-wangqing@vivo.com>

On Tue, 2021-03-16 at 19:59 +0800, Wang Qing wrote:
> This function just puts wait into queue, and does not do an operation similar
> to prepare_to_wait() in wait.c.
> And during the operation, the caller needs to hold the lock to protect.

I see zero benefit to churn like this.  You're taking a dinky little
file that's perfectly clear (and pretty), and restating the obvious.

>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
> ---
>  kernel/sched/completion.c | 2 +-
>  kernel/sched/sched.h      | 2 +-
>  kernel/sched/swait.c      | 6 +++---
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
> index a778554..3d28a5a
> --- a/kernel/sched/completion.c
> +++ b/kernel/sched/completion.c
> @@ -79,7 +79,7 @@ do_wait_for_common(struct completion *x,
>  				timeout = -ERESTARTSYS;
>  				break;
>  			}
> -			__prepare_to_swait(&x->wait, &wait);
> +			add_swait_queue_locked(&x->wait, &wait);
>  			__set_current_state(state);
>  			raw_spin_unlock_irq(&x->wait.lock);
>  			timeout = action(timeout);
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 10a1522..0516f50
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -2719,4 +2719,4 @@ static inline bool is_per_cpu_kthread(struct task_struct *p)
>  #endif
>
>  void swake_up_all_locked(struct swait_queue_head *q);
> -void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait);
> +void add_swait_queue_locked(struct swait_queue_head *q, struct swait_queue *wait);
> diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c
> index 7a24925..f48a544
> --- a/kernel/sched/swait.c
> +++ b/kernel/sched/swait.c
> @@ -82,7 +82,7 @@ void swake_up_all(struct swait_queue_head *q)
>  }
>  EXPORT_SYMBOL(swake_up_all);
>
> -void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait)
> +void add_swait_queue_locked(struct swait_queue_head *q, struct swait_queue *wait)
>  {
>  	wait->task = current;
>  	if (list_empty(&wait->task_list))
> @@ -94,7 +94,7 @@ void prepare_to_swait_exclusive(struct swait_queue_head *q, struct swait_queue *
>  	unsigned long flags;
>
>  	raw_spin_lock_irqsave(&q->lock, flags);
> -	__prepare_to_swait(q, wait);
> +	add_swait_queue_locked(q, wait);
>  	set_current_state(state);
>  	raw_spin_unlock_irqrestore(&q->lock, flags);
>  }
> @@ -114,7 +114,7 @@ long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait
>  		list_del_init(&wait->task_list);
>  		ret = -ERESTARTSYS;
>  	} else {
> -		__prepare_to_swait(q, wait);
> +		add_swait_queue_locked(q, wait);
>  		set_current_state(state);
>  	}
>  	raw_spin_unlock_irqrestore(&q->lock, flags);


      reply	other threads:[~2021-03-17  5:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 11:59 [PATCH] sched: rename __prepare_to_swait() to add_swait_queue_locked() Wang Qing
2021-03-17  5:12 ` Mike Galbraith [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=284138d64b5010ebe5a6490402dc01d006677dd1.camel@gmx.de \
    --to=efault@gmx.de \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=wangqing@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;
as well as URLs for NNTP newsgroup(s).