Re: set_page_dirty vs set_page_dirty_lock

From: Nick Piggin
Date: Sun Dec 11 2005 - 22:27:51 EST


Michael S. Tsirkin wrote:
Quoting Hugh Dickins <hugh@xxxxxxxxxxx>:

Many would be pleased if we could manage without set_page_dirty_lock.


It seems that I can do

if (TestSetPageLocked(page))
schedule_work()

and in this way, avoid the schedule_work overhead for the common case
where the page isnt locked.
Right?


I think you can do that - provided you ensure the page mapping hasn't
disappeared after locking it. However, I think you should try to the
simplest way first.

If that works, I can mostly do things directly,
although I'm still stuck with the problem of an app performing
a fork + write into the same page while I'm doing DMA there.

I am currently solving this by doing a second get_user_pages after
DMA is done and comparing the page lists, but this, of course,
needs a task context ...


Usually we don't care about these kinds of races happening. So long
as it doesn't oops the kernel or hang the hardware, it is up to
userspace not to do stuff like that.

Nick

--
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com -
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/