mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: qianjun.kernel@gmail.com, peterz@infradead.org, will@kernel.org,
	luto@kernel.org, linux-kernel@vger.kernel.org, urezki@gmail.com
Cc: laoar.shao@gmail.com, jun qian <qianjun.kernel@gmail.com>
Subject: Re: [RFC PATCH v2] Softirq:avoid large sched delay from the pending softirqs
Date: Wed, 22 Jul 2020 20:05:22 +0200	[thread overview]
Message-ID: <87eep32zod.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <1595250506-9769-1-git-send-email-qianjun.kernel@gmail.com>

qianjun.kernel@gmail.com writes:
> +
> +		end = ktime_get();
> +		delta = ktime_to_us(end - start);

What's the point of this conversion? That's a division for no value
because you can simply define the maximum time in nanoseconds with the
same effect, i.e.

	ktime_t end = ktime_get() + MAX_SOFTIRQ_TIME_NS;

	if (need_resched() && ktime_get() > end)
		break;

So you can spare all that start, delta and conversion dance and keep the
code simple.

Also notice that need_resched() wants to be evaluated first because
there is no point to do the more expensive time read if need_resched()
is false.

Thanks,

        tglx

  parent reply	other threads:[~2020-07-22 18:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 13:08 qianjun.kernel
2020-07-22  4:58 ` jun qian
2020-07-22 18:05 ` Thomas Gleixner [this message]
2020-07-23  4:48   ` jun qian
2020-07-23  9:17 ` [Softirq] a76eadba0d: WARNING:at_net/mac80211/rx.c:#ieee80211_rx_napi[mac80211] kernel test robot
2020-07-23 10:58   ` Thomas Gleixner
2020-07-23 13:57     ` jun qian
2020-07-23 14:35       ` Thomas Gleixner
2020-07-24  5:35         ` jun qian
2020-07-24 23:31           ` Thomas Gleixner

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=87eep32zod.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=qianjun.kernel@gmail.com \
    --cc=urezki@gmail.com \
    --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