cvs commit: src/sys/kern kern_sig.c
David Xu
davidxu at freebsd.org
Wed Mar 2 22:55:41 GMT 2005
John Baldwin wrote:
>On Wednesday 02 March 2005 08:43 am, David Xu wrote:
>
>
>>davidxu 2005-03-02 13:43:51 UTC
>>
>> FreeBSD src repository
>>
>> Modified files:
>> sys/kern kern_sig.c
>> Log:
>> In kern_sigtimedwait, remove waitset bits for td_sigmask before
>> sleeping, so in do_tdsignal, we no longer need to test td_waitset.
>> now td_waitset is only used to give a thread higher priority when
>> delivering signal to multithreads process.
>> This also fixes a bug:
>> when a thread in sigwait states was suspended and later resumed
>> by SIGCONT, it can no longer receive signals belong to waitset.
>>
>>
>
>Is this related at all to Peter Holm's panic where sigwait() + swapping
>invokes a panic?
>
>
>
No. Peter Holm's found is a swapping problem. vm swaps out sleeping
thread's stack under memory stressing case. but I think that's not safe,
that means, following code can not be used in kernel:
int *p;
func()
{
int n;
n = 0;
p = &n;
msleep(p);
/* check variable n ...
}
func2()
{
*p = 2;
wakeup(p);
}
unless million lines of kernel code are reviewed, I don't think the
vm code is safe. The following patch should avoid the problem:
Index: vm_glue.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_glue.c,v
retrieving revision 1.210
diff -u -r1.210 vm_glue.c
--- vm_glue.c 22 Jan 2005 19:21:29 -0000 1.210
+++ vm_glue.c 2 Mar 2005 11:22:32 -0000
@@ -334,6 +334,7 @@
void
vm_thread_swapout(struct thread *td)
{
+#if 0
vm_object_t ksobj;
vm_page_t m;
int i, pages;
@@ -353,6 +354,7 @@
vm_page_unlock_queues();
}
VM_OBJECT_UNLOCK(ksobj);
+#endif
}
/*
---
David Xu
More information about the cvs-src
mailing list