From: Oleg Nesterov <oleg@tv-sign.ru>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Austin Clements <amdragon+kernelbugzilla@mit.edu>,
Ingo Molnar <mingo@elte.hu>, john stultz <johnstul@us.ibm.com>,
Michael Kerrisk <mtk.manpages@googlemail.com>,
Roland McGrath <roland@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] posix timers: use SIGQUEUE_CANCELLED when the timer is destroyed
Date: Sun, 18 May 2008 21:15:43 +0400 [thread overview]
Message-ID: <20080518171543.GA25855@tv-sign.ru> (raw)
In-Reply-To: <alpine.LFD.1.10.0805171006090.3020@woody.linux-foundation.org>
On 05/17, Linus Torvalds wrote:
>
> On Sat, 17 May 2008, Oleg Nesterov wrote:
>
> > On 05/17, Oleg Nesterov wrote:
> > >
> > > This is a user visible change. With this patch sys_timer_delete() discards
> > > the pending signal which was generated by the timer.
> >
> > If this change is undesirable, we can (for example) do
> >
> > --- kernel/posix-timers.c
> > +++ kernel/posix-timers.c
> > @@ -885,6 +885,7 @@ itimer_delete(struct k_itimer *timer)
> > timer->it_process = NULL;
> >
> > unlock_timer(timer, flags);
> > + tmr->sigq->flags |= SIGQUEUE_CANCELLED;
> > release_posix_timer(timer, IT_ID_SET);
> > }
> >
> > instead, and still fix the "BUG 10460".
>
> The only reason I like that better is that it makes me nervous when one
> re-initializes the whole flags field. So your original 3/3 patch
>
> - q->flags &= ~SIGQUEUE_PREALLOC;
> + q->flags = SIGQUEUE_CANCELLED; /* clears SIGQUEUE_PREALLOC */
>
> just makes me go "Hmm, what about all the other flag bits?"
Yes, this is another reason for a separate patch.
> Now, admittedly, there are currently (with your patch) just two
> SIGQUEUE_xyz bits, so by just doing that single assignment, you really
> only modify the two bits you want to modify. But maybe that will change.
> So I'd prefer to either write it as
>
> q->flags &= ~SIGQUEUE_PREALLOC;
> q->flags |= SIGQUEUE_CANCELLED;
Initially, I did
q->flags |= SIGQUEUE_CANCELLED;
spin_lock_irqsave(lock, flags);
q->flags &= ~SIGQUEUE_PREALLOC;
to document the fact that SIGQUEUE_CANCELLED can be set lockless, but
then "optimized" the code, couldn't help myself... Besides, the code
above looks really confusing without the fat comment.
Another reason. We are losing the control over "q" here, I don't think
we can have other flags which should be preserved once we set _CANCELLED
and cleared _PREALLOC.
But yes, I agree, this is not a good practice. I'd leave the patch as is
at least for now but I don't mind to redo and resend. Fortunately, this
falls to the "cleanup" category.
Oleg.
next prev parent reply other threads:[~2008-05-18 17:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-17 15:14 [PATCH 3/3] posix timers: use SIGQUEUE_CANCELLED when the timer is destroyed Oleg Nesterov
2008-05-17 15:31 ` Oleg Nesterov
2008-05-17 17:11 ` Linus Torvalds
2008-05-18 17:15 ` Oleg Nesterov [this message]
2008-05-18 17:24 ` Linus Torvalds
2008-05-18 17:40 ` Linus Torvalds
2008-05-18 17:46 ` Oleg Nesterov
2008-05-21 2:27 ` Roland McGrath
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=20080518171543.GA25855@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=amdragon+kernelbugzilla@mit.edu \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mtk.manpages@googlemail.com \
--cc=roland@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.