All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfreds@colorfullife.com>
To: Alexander Viro <viro@math.psu.edu>
Cc: Andrea Arcangeli <andrea@suse.de>,
	linux-kernel@vger.rutgers.edu,
	Ingo Molnar <mingo@chiara.csoma.elte.hu>,
	linux-mm@kvack.org
Subject: Re: locking question: do_mmap(), do_munmap()
Date: Sun, 10 Oct 1999 18:45:51 +0200	[thread overview]
Message-ID: <3800C2BF.716C9D65@colorfullife.com> (raw)
In-Reply-To: Pine.GSO.4.10.9910101219370.16317-100000@weyl.math.psu.edu

Alexander Viro wrote:
> 
> 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.

Yes, it should cause oops?

> > Plonking the big lock around every access to VM is _not_ a solution

I never did that, I'll never do that, I only notice that the current
code is filled with races.

> >. 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)?

lock_kernel() is dropped on thread switch, the semaphore is not dropped.

> 
> 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.

AFAIK the problem is OOM:
* a process accesses a not-present, ie page fault:
...
handle_mm_fault(): this process own mm->mmap_sem.
->handle_pte_fault().
-> (eg.) do_wp_page().
-> get_free_page().
now get_free_page() notices that there is no free memory.
--> wakeup kswapd.

* the swapper runs, and it tries to swap out data from that process.
mm->mmap_sem is already acquired --> lock-up.

--
	Manfred
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

  reply	other threads:[~1999-10-10 16:45 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.10.9910101713010.364-100000@alpha.random>
1999-10-10 15:52 ` locking question: do_mmap(), do_munmap() Manfred Spraul
1999-10-10 16:07   ` Alexander Viro
1999-10-10 16:25     ` Alexander Viro
1999-10-10 16:45       ` Manfred Spraul [this message]
1999-10-10 17:25         ` Alexander Viro
1999-10-10 17:12       ` Andrea Arcangeli
1999-10-10 17:48         ` Alexander Viro
1999-10-10 18:42           ` Manfred Spraul
1999-10-10 19:03             ` Alexander Viro
1999-10-10 21:31               ` Manfred Spraul
1999-10-10 21:53               ` Andrea Arcangeli
1999-10-10 22:34                 ` Alexander Viro
1999-10-10 23:28                   ` Andrea Arcangeli
1999-10-11 15:50               ` Stephen C. Tweedie
1999-10-11 16:05                 ` Alexander Viro
1999-10-11 18:02                   ` Manfred Spraul
1999-10-11 19:07                     ` Kanoj Sarcar
1999-10-11 22:23                       ` Stephen C. Tweedie
1999-10-13  1:25                         ` Kanoj Sarcar
1999-10-13  7:32                           ` Manfred Spraul
1999-10-13  7:32                             ` Manfred Spraul
1999-10-15  9:58                             ` Ralf Baechle
1999-10-15  9:58                               ` Ralf Baechle
1999-10-15 17:50                               ` Kanoj Sarcar
1999-10-15 17:50                                 ` Kanoj Sarcar
1999-10-13 10:45                           ` Stephen C. Tweedie
1999-10-11 20:15                     ` Stephen C. Tweedie
1999-10-11 21:14                       ` Manfred Spraul
1999-10-11 21:37                     ` Alexander Viro
1999-10-11 22:13                       ` Manfred Spraul
1999-10-11 22:22                     ` Stephen C. Tweedie
1999-10-11 23:01                       ` Alexander Viro
1999-10-12 14:06                         ` [more fun] " Alexander Viro
1999-10-13  7:35                           ` Manfred Spraul
1999-10-13 18:34                             ` Kanoj Sarcar
1999-10-13 10:16                         ` Stephen C. Tweedie
1999-10-11 20:13                   ` Stephen C. Tweedie
1999-10-11 21:40                     ` Alexander Viro
1999-10-11 22:20                       ` Stephen C. Tweedie
1999-10-11 22:31                         ` Alexander Viro
1999-10-13 10:25                           ` Stephen C. Tweedie
1999-10-11 15:47             ` Stephen C. Tweedie
1999-10-11 15:43         ` Stephen C. Tweedie
1999-10-10 16:56     ` Andrea Arcangeli
1999-10-11 15:41     ` Stephen C. Tweedie
1999-10-11 15:52       ` Alexander Viro
1999-10-09 12:48 Manfred Spraul
1999-10-09 13:12 ` Alexander Viro
1999-10-09 13:17   ` Manfred Spraul
1999-10-09 13:38     ` Alexander Viro
1999-10-09 16:01   ` Andrea Arcangeli
1999-10-10 13:05     ` Manfred Spraul
1999-10-11 15:09       ` Stephen C. Tweedie
1999-10-11 15:05     ` Stephen C. Tweedie

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=3800C2BF.716C9D65@colorfullife.com \
    --to=manfreds@colorfullife.com \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=linux-mm@kvack.org \
    --cc=mingo@chiara.csoma.elte.hu \
    --cc=viro@math.psu.edu \
    /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.