Re: CONFIG_PREEMPT and server workloads

From: Andrea Arcangeli
Date: Thu Mar 18 2004 - 13:45:48 EST


On Thu, Mar 18, 2004 at 10:26:23AM -0800, Andrew Morton wrote:
> Andrea Arcangeli <andrea@xxxxxxx> wrote:
> >
> > > They do? kmap_atomic() disables preemption anyway.
> >
> > dunno why but see:
> >
> > spin_lock(&mm->page_table_lock);
> > page_table = pte_offset_map(pmd, address);
> >
> > pte_unmap(page_table);
> > spin_unlock(&mm->page_table_lock);
> >
>
> do_wp_page()? The lock is there to pin the pte down isn't it? Maybe it
> can be optimised - certainly the spin_unlock() in there can be moved up a
> few statements.

It's not needed, we need the lock only when we _read_ the pte, not
during the kmap_atomic. The kmap_atomic is just a window on some highmem
rmap, it has no clue what's there and it can't affect the locking in any
way. The only thing it matters is that we don't schedule.

so taking locks regularly earlier than needed sounds a bit confusing,
since somebody could think they're really needed there.

> Could be. When I did that code I had some printks in the slow path and
> although it did trigger, it was rare. We've already faulted the page in by

I agree it must be _very_ rare ;). Writing zeros isn't very useful
anyways. And while swapping the scalability don't matter much anywyas.

> hand so we should only fall into the kmap() if the page was suddenly stolen
> again.

Oh so you mean the page fault insn't only interrupting the copy-user
atomically, but the page fault is also going to sleep and pagein the
page? I though you didn't want to allow other tasks to steal the kmap
before you effectively run the kunmap_atomic. I see it can be safe if
kunmap_atomic is a noop though, but you're effectively allowing
scheduling inside a kmap this way.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/