From: Andrew Morton <akpm@osdl.org>
To: george@mvista.com
Cc: boris.hu@intel.com, drepper@redhat.com, adam.li@intel.com,
linux-kernel@vger.kernel.org, akpm@digeo.com
Subject: Re: [PATCH] Bugfix for CLOCK_REALTIME absolute timer.
Date: Mon, 28 Jun 2004 15:17:25 -0700 [thread overview]
Message-ID: <20040628151725.09b691e4.akpm@osdl.org> (raw)
In-Reply-To: <40E094DB.9000702@mvista.com>
George Anzinger <george@mvista.com> wrote:
>
> Andrew,
>
> Boris and I have kicked this around enough. It think it is ready for prime time.
>
> static void schedule_next_timer(struct k_itimer *timr)
> {
> ...
> + do {
> + seq = read_seqbegin(&xtime_lock);
> + new_wall_to = wall_to_monotonic;
> + posix_get_now(&now);
> + } while (read_seqretry(&xtime_lock, seq));
> +
> + if (!list_empty(&timr->abs_timer_entry)) {
> + spin_lock(&abs_list.lock);
> + add_clockset_delta(timr, &new_wall_to);
> + }
> +
> do {
> posix_bump_timer(timr);
> }while (posix_time_before(&timr->it_timer, &now));
>
> + if (!list_empty(&timr->abs_timer_entry))
> + spin_unlock(&abs_list.lock);
The locking in here is a bit ugly. Does the lock actually need to be held while
the timer is being bumped?
And what is the upper bound on that while loop?
> tmr->it_id = (timer_t)-1;
> + INIT_LIST_HEAD(&tmr->abs_timer_entry);
> if (unlikely(!(tmr->sigq = sigqueue_alloc()))) {
The cat ate your tab key? ;)
> + if (!list_empty(&timr->abs_timer_entry)) {
> + spin_lock(&abs_list.lock);
> + list_del_init(&timr->abs_timer_entry);
> + spin_unlock(&abs_list.lock);
> + }
This is repeated often. Does it merit its own function?
> +static DECLARE_MUTEX(clock_was_set_lock);
> +#define mutex_enter(x) down(x)
> +#define mutex_enter_interruptable(x) down_interruptible(x)
> +#define mutex_exit(x) up(x)
Please open-code these operations.
next prev parent reply other threads:[~2004-06-28 22:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-03 9:56 [PATCH] One possible bugfix for CLOCK_REALTIME timer Hu, Boris
2004-06-04 0:36 ` George Anzinger
2004-06-28 21:59 ` [PATCH] Bugfix for CLOCK_REALTIME absolute timer George Anzinger
2004-06-28 22:17 ` Andrew Morton [this message]
2004-06-28 22:55 ` George Anzinger
2004-06-29 4:48 ` George Anzinger
2004-06-29 4:57 ` Andrew Morton
2004-06-29 8:45 ` George Anzinger
2004-06-30 19:13 ` George Anzinger
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=20040628151725.09b691e4.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=adam.li@intel.com \
--cc=akpm@digeo.com \
--cc=boris.hu@intel.com \
--cc=drepper@redhat.com \
--cc=george@mvista.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®