mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Satendra Singh Thakur <sst2005@gmail.com>
Cc: satendrasingh.thakur@hcl.com, tglx@linutronix.de,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] [semaphore] Removed redundant code from semaphore's down family of function
Date: Fri, 30 Aug 2019 12:46:04 +0200	[thread overview]
Message-ID: <20190830104604.GC2369@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190830104011.15568-1-sst2005@gmail.com>

On Fri, Aug 30, 2019 at 04:10:10PM +0530, Satendra Singh Thakur wrote:

> > +static inline long schedule_timeout(long timeout)
> > +{
> > +	if (__builtin_constant_p(timeout) && timeout == MAX_SCHEDULE_TIMEOUT) {
> > +		schedule();
> > +		return timeout;
> > +	}
> > +
> > +	return __schedule_timeout(timeout);
> > +}

> > +	if (timeout == MAX_SCHEDULE_TIMEOUT) {
> > 		schedule();
> > -		goto out;
> Hi Mr Peter,
> I have a suggestion here:
> The condition timeout == MAX_SCHEDULE_TIMEOUT is already handled in
> schedule_timeout function

Only if it is a compile time constant; otherwise it will end up here.

> and  same conditon is handled again in __schedule_timeout.
> Currently, no other function calls __schedule_timeout except schedule_timeout.
> Therefore, it seems this condition will never become true.

Please read more careful.


      reply	other threads:[~2019-08-30 10:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12  5:31 [PATCH] " Satendra Singh Thakur
2019-08-12  9:12 ` Will Deacon
2019-08-12 13:48 ` [PATCH v1] " Satendra Singh Thakur
2019-08-22 15:51   ` Peter Zijlstra
2019-08-24  3:50     ` Satendra Singh Thakur
2019-08-26 14:14       ` Peter Zijlstra
2019-08-26 14:25         ` Peter Zijlstra
2019-08-27  0:06           ` sched,time: Allow better constprop/DCE for schedule_timeout() kbuild test robot
2019-08-27  1:26           ` kbuild test robot
2019-08-30 10:40           ` [PATCH v1] [semaphore] Removed redundant code from semaphore's down family of function Satendra Singh Thakur
2019-08-30 10:46             ` Peter Zijlstra [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=20190830104604.GC2369@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=satendrasingh.thakur@hcl.com \
    --cc=sst2005@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome