From: Nick Piggin <nickpiggin@yahoo.com.au>
To: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Hugh Dickins <hugh@veritas.com>,
Gleb Natapov <gleb@minantech.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Petr Vandrovec <vandrove@vc.cvut.cz>,
Badari Pulavarty <pbadari@us.ibm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: set_page_dirty vs set_page_dirty_lock
Date: Mon, 12 Dec 2005 18:10:02 +1100 [thread overview]
Message-ID: <439D224A.7080007@yahoo.com.au> (raw)
In-Reply-To: <20051212063521.GB24168@mellanox.co.il>
Michael S. Tsirkin wrote:
> Quoting Nick Piggin <nickpiggin@yahoo.com.au>:
>
>>I think you can do that - provided you ensure the page mapping hasn't
>>disappeared after locking it.
>
>
> Ugh. I dont really know how to do that.
> Isnt this sufficient?
>
> if (TestSetPageLocked(page))
> schedule_work(...)
> set_page_dirty(page)
> unlock_page(page)
>
> Thats all there seems to be set_page_dirty_lock does if it is called when
> PG_Locked bit is clear.
>
Oh yeah you are right - set_page_dirty does the check for you. Sorry
for the misinformation.
>
>>However, I think you should try to the simplest way first.
>
>
> Thanks, Nick, thats what I have now, this already works for me here
> https://openib.org/svn/gen2/trunk/src/linux-kernel/infiniband/ulp/sdp/sdp_iocb.c
> I'm looking at ways to improve performance, though.
>
Oh good :)
>
>>>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.
>
>
> Note that I am, even, not necessarily talking about full pages
> here: an application could be writing to one part of a page
> while hardware DMAs another part of it.
> So the app is not necessarily buggy.
>
Sorry, I might have misunderstdood: what's the race? And how does
a second get_user_pages solve it?
> It seems to me people really dont want to change their applications.
> They just want to load a library and have it go faster.
> Given that I'm implementing a socket protocol, we are talking about
> an awful lot of applications that currently work fine on top of TCP.
>
Understandable.
Nick
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
next prev parent reply other threads:[~2005-12-12 7:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-08 19:09 set_page_dirty vs set_page_dirty_lock Michael S. Tsirkin
2005-12-08 19:19 ` Hugh Dickins
2005-12-08 19:29 ` Michael S. Tsirkin
2005-12-08 19:54 ` Jens Axboe
2005-12-08 21:56 ` Michael S. Tsirkin
2005-12-12 3:28 ` Nick Piggin
2005-12-12 6:35 ` Michael S. Tsirkin
2005-12-12 7:10 ` Nick Piggin [this message]
2005-12-12 8:14 ` Michael S. Tsirkin
2005-12-12 8:32 ` Nick Piggin
2005-12-12 8:55 ` Michael S. Tsirkin
2005-12-12 9:23 ` Nick Piggin
2005-12-12 9:59 ` Michael S. Tsirkin
2005-12-13 21:07 ` Michael S. Tsirkin
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=439D224A.7080007@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=benh@kernel.crashing.org \
--cc=gleb@minantech.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@mellanox.co.il \
--cc=pbadari@us.ibm.com \
--cc=vandrove@vc.cvut.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox