mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Minfei Huang <mnghuan@gmail.com>
To: john.stultz@linaro.org, tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Make clocksource insert entry more efficiently
Date: Sat, 30 Apr 2016 18:17:48 +0800	[thread overview]
Message-ID: <20160430101748.GC27909@huangminfeis-MacBook-Pro.local> (raw)
In-Reply-To: <1461576028-2197-1-git-send-email-mnghuan@gmail.com>

Ping.

Any comment is appreciate.

Thanks
Minfei

On 04/25/16 at 05:20P, Minfei Huang wrote:
> It is unnecessary to continue looping the list, if we find there is an
> entry that the value of rating is smaller than the new one. It is safe
> to be out the loop, because all of entry are inserted in descending
> order.
> 
> Signed-off-by: Minfei Huang <mnghuan@gmail.com>
> ---
>  kernel/time/clocksource.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
> index 56ece14..6a5a310 100644
> --- a/kernel/time/clocksource.c
> +++ b/kernel/time/clocksource.c
> @@ -669,10 +669,12 @@ static void clocksource_enqueue(struct clocksource *cs)
>  	struct list_head *entry = &clocksource_list;
>  	struct clocksource *tmp;
>  
> -	list_for_each_entry(tmp, &clocksource_list, list)
> +	list_for_each_entry(tmp, &clocksource_list, list) {
>  		/* Keep track of the place, where to insert */
> -		if (tmp->rating >= cs->rating)
> -			entry = &tmp->list;
> +		if (tmp->rating < cs->rating)
> +			break;
> +		entry = &tmp->list;
> +	}
>  	list_add(&cs->list, entry);
>  }
>  
> -- 
> 2.6.3
> 

  reply	other threads:[~2016-04-30 10:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25  9:20 Minfei Huang
2016-04-30 10:17 ` Minfei Huang [this message]
2016-05-02 17:39 ` John Stultz
2016-05-03  3:32   ` Minfei Huang

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=20160430101748.GC27909@huangminfeis-MacBook-Pro.local \
    --to=mnghuan@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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®