* Re: Collapsing RT signals ...
@ 2001-06-25 4:21 Dan Kegel
2001-06-25 15:30 ` Davide Libenzi
2001-06-25 15:43 ` Davide Libenzi
0 siblings, 2 replies; 4+ messages in thread
From: Dan Kegel @ 2001-06-25 4:21 UTC (permalink / raw)
To: Davide Libenzi, linux-kernel@vger.kernel.org
Davide Libenzi <davidel@xmailserver.org> wrote:
> I'm making some test with RT signals and looking at how they're implemented
> inside the kernel.
> After having experienced frequent queue overflow signals I looked at how
> signals are queued inside the task_struct.
> There's no signals optimization inside and this make the queue length depending
> on the request rate instead of the number of connections.
> It can happen that two ( or more ) POLL_IN signals are queued with a single
> read() that sweep the buffer leaving other signals to issue reads ( read this
> as user-mode / kernel-mode switch ) that will fail due lack of data.
> So for every "superfluous" signal we'll have two user-mode / kernel-mode
> switches, one for signal delivery and one for a failing read().
> I'm just thinking at a way to optimize the signal delivery that is ( draft ) :
> ...
I agree, the queue overflow case is a pain in the butt.
Before you get too far coding up your idea, have you read
http://marc.theaimsgroup.com/?l=linux-kernel&m=99023775430848&w=2
? He's already implemented and benchmarked a variation on this
idea, maybe you could vet his code. He has taken it a step
further than perhaps you were going to.
(See also http://www.kegel.com/c10k.html#nb.sigio )
- Dan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Collapsing RT signals ...
2001-06-25 4:21 Collapsing RT signals Dan Kegel
@ 2001-06-25 15:30 ` Davide Libenzi
2001-06-25 15:43 ` Davide Libenzi
1 sibling, 0 replies; 4+ messages in thread
From: Davide Libenzi @ 2001-06-25 15:30 UTC (permalink / raw)
To: Dan Kegel; +Cc: linux-kernel@vger.kernel.org
On 25-Jun-2001 Dan Kegel wrote:
> Davide Libenzi <davidel@xmailserver.org> wrote:
>> I'm making some test with RT signals and looking at how they're implemented
>> inside the kernel.
>> After having experienced frequent queue overflow signals I looked at how
>> signals are queued inside the task_struct.
>> There's no signals optimization inside and this make the queue length
>> depending
>> on the request rate instead of the number of connections.
>> It can happen that two ( or more ) POLL_IN signals are queued with a single
>> read() that sweep the buffer leaving other signals to issue reads ( read
>> this
>> as user-mode / kernel-mode switch ) that will fail due lack of data.
>> So for every "superfluous" signal we'll have two user-mode / kernel-mode
>> switches, one for signal delivery and one for a failing read().
>> I'm just thinking at a way to optimize the signal delivery that is ( draft )
>> :
>> ...
>
> I agree, the queue overflow case is a pain in the butt.
>
> Before you get too far coding up your idea, have you read
> http://marc.theaimsgroup.com/?l=linux-kernel&m=99023775430848&w=2
> ? He's already implemented and benchmarked a variation on this
> idea, maybe you could vet his code. He has taken it a step
> further than perhaps you were going to.
I'll do for sure, thank You.
>
> (See also http://www.kegel.com/c10k.html#nb.sigio )
I already knew Your document, pretty cool.
- Davide
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Collapsing RT signals ...
2001-06-25 4:21 Collapsing RT signals Dan Kegel
2001-06-25 15:30 ` Davide Libenzi
@ 2001-06-25 15:43 ` Davide Libenzi
1 sibling, 0 replies; 4+ messages in thread
From: Davide Libenzi @ 2001-06-25 15:43 UTC (permalink / raw)
To: Dan Kegel; +Cc: linux-kernel@vger.kernel.org
On 25-Jun-2001 Dan Kegel wrote:
> Davide Libenzi <davidel@xmailserver.org> wrote:
>> I'm making some test with RT signals and looking at how they're implemented
>> inside the kernel.
>> After having experienced frequent queue overflow signals I looked at how
>> signals are queued inside the task_struct.
>> There's no signals optimization inside and this make the queue length
>> depending
>> on the request rate instead of the number of connections.
>> It can happen that two ( or more ) POLL_IN signals are queued with a single
>> read() that sweep the buffer leaving other signals to issue reads ( read
>> this
>> as user-mode / kernel-mode switch ) that will fail due lack of data.
>> So for every "superfluous" signal we'll have two user-mode / kernel-mode
>> switches, one for signal delivery and one for a failing read().
>> I'm just thinking at a way to optimize the signal delivery that is ( draft )
>> :
>> ...
>
> I agree, the queue overflow case is a pain in the butt.
>
> Before you get too far coding up your idea, have you read
> http://marc.theaimsgroup.com/?l=linux-kernel&m=99023775430848&w=2
Double thank You Dan, they did exactly what I want to do :)
- Davide
^ permalink raw reply [flat|nested] 4+ messages in thread
* Collapsing RT signals ...
@ 2001-06-25 1:03 Davide Libenzi
0 siblings, 0 replies; 4+ messages in thread
From: Davide Libenzi @ 2001-06-25 1:03 UTC (permalink / raw)
To: linux-kernel
I'm making some test with RT signals and looking at how they're implemented
inside the kernel.
After having experienced frequent queue overflow signals I looked at how
signals are queued inside the task_struct.
There's no signals optimization inside and this make the queue length depending
on the request rate instead of the number of connections.
It can happen that two ( or more ) POLL_IN signals are queued with a single
read() that sweep the buffer leaving other signals to issue reads ( read this
as user-mode / kernel-mode switch ) that will fail due lack of data.
So for every "superfluous" signal we'll have two user-mode / kernel-mode
switches, one for signal delivery and one for a failing read().
I'm just thinking at a way to optimize the signal delivery that is ( draft ) :
struct sigqueue {
struct sigqueue *next;
struct sigqueue **fsig;
siginfo_t info;
};
struct fown_struct {
int pid; /* pid or -pgrp where SIGIO should be sent */
uid_t uid, euid; /* uid/euid of process setting the owner */
int signum; /* posix.1b rt signal to be delivered on IO */
struct sigqueue *sig_hint;
};
At the end we'll have ( where fsig = &file->fown.sig_hint ) :
static int send_signal_hint(int sig, struct siginfo *info,
struct sigpending *signals, struct sigqueue **fsig) {
if (*fsig != NULL)
merge_info(&(*fsig)->info, info);
else {
*fsig = allog_sig_queue();
(*fsig)->fsig = fsig;
copy_info(&(*fsig)->info, info);
...
add-to-queue();
...
}
...
}
When the message is delivered we'll have :
void clean_sig_hint(struct sigqueue *qsig) {
if (qsig->fsig != NULL) {
*(qsig->fsig) = NULL;
qsig->fsig = NULL;
}
}
When the file is closed :
void clean_fown_sighint(struct fown_struct *fown) {
if (fown->sig_hint != NULL) {
fown->sig_hint->fsig = NULL;
fown->sig_hint = NULL;
}
}
All these ops must be done under sigmask_lock lock ( send_signal() and signal
dequeue already does ).
This will make multiple signal from the same file to be stocked inside the same
slot reducing the RT signal traffic.
Comments ?
- Davide
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-06-25 15:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-25 4:21 Collapsing RT signals Dan Kegel
2001-06-25 15:30 ` Davide Libenzi
2001-06-25 15:43 ` Davide Libenzi
-- strict thread matches above, loose matches on Subject: below --
2001-06-25 1:03 Davide Libenzi
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.