Re: locking question: do_mmap(), do_munmap()

Alexander Viro
1999-10-10T16:25:33Z

On Sun, 10 Oct 1999, Alexander Viro wrote:

>
> [Cc'd to mingo]
>
> On Sun, 10 Oct 1999, Manfred Spraul wrote:
>
> > I've started adding "assert_down()" and "assert_kernellocked()" macros,
> > and now I don't see the login prompt any more...
> >
> > eg. sys_mprotect calls merge_segments without lock_kernel().
>
> Manfred, Andrea - please stop it. Yes, it does and yes, it should.
> Plonking the big lock around every access to VM is _not_ a solution. If
> swapper doesn't use mmap_sem - _swapper_ should be fixed. How the hell
> does lock_kernel() have smaller deadlock potential than
> down(&mm->mmap_sem)?

OK, folks. Code in swapper (unuse_process(), right?) is called only from
sys_swapoff(). It's a syscall. Andrea, could you show a scenario for
deadlock here? OK, some process (but not the process doing swapoff()) may
have the map locked So? it is not going to release the thing - we are
seriously screwed anyway (read: we already are in deadlock). We don't hold
the semaphore ourselves.

Andrea, post a deadlock scenario, please.