Re: [kerneloops] regression in 2.6.27 wrt "lock_page" and the"hwclock" program

From: Ingo Molnar
Date: Mon Oct 13 2008 - 12:03:30 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

>
>
> On Mon, 13 Oct 2008, Ingo Molnar wrote:
> >
> > do you agree with the changelog and can i add your Signed-off-by ?
>
> Sure. One thing I'd still like to see is that crazy "again" vs
> "survive" mess for x86-64 vs x86-32. I think the patch as posted will
> cause a new warning on x86-32 due to "unused label 'again'" or
> similar.
>
> It's totally insane that we have two different versions of the oom
> handling for x86. I don't know why we do that, it's probably
> historical, and I _suspect_ that the 32-bit one has gotten a lot more
> testing.
>
> And not just because there have been more of the 32-bit kernels
> around, but also because low-memory situations are probably more
> common on 32-bit setups. But I dunno.
>
> So I would suggest you just pick the x86-32 version of that oom
> handling thing too. Unless you know some deep reason why the 64-bit
> one would be superior.

hm, i think the 64-bit case is the correct code, because in this 'init
task OOMs' case we do:

out_of_memory:
up_read(&mm->mmap_sem);
if (is_global_init(tsk)) {
yield();
down_read(&mm->mmap_sem);

note that we drop the mmap_sem, so in theory another thread of this same
MM could change the vma tree, and our 'vma' might not be valid anymore.

It's probably not a real issue in practice because this is about PID 1,
so i doubt it really matters, but still.

So how about the patch below?

Ingo

---------------->