From: Minchan Kim <minchan.kim@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Eric Dumazet <dada1@cosmosbay.com>,
lkml <linux-kernel@vger.kernel.org>,
Darren Hart <dvhltc@us.ibm.com>
Subject: Re: Question about PRIVATE_FUTEX
Date: Fri, 27 Mar 2009 19:56:41 +0900 [thread overview]
Message-ID: <28c262360903270356x6a9fc929m96941de8f8201fb0@mail.gmail.com> (raw)
In-Reply-To: <1238143759.7808.2885.camel@twins>
Hi, Perter.
Thanks for joining this thread.
My concern is page reclaimer can reclaim the user page which have
futex between get_fuex_key and get_futex_value_locked.
On Fri, Mar 27, 2009 at 5:49 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Fri, 2009-03-27 at 11:12 +0900, Minchan Kim wrote:
>> Hi, Peter and Eric.
>>
>> I am not expert about futex.
>> I am sorry if this is dumb question.
>>
>> If we use private futex, get_futex_key don't call get_user_pages_fast
>> which pins page at page table.
>
> But also drops that page ref at the end of get_futex_key(). The whole
> and only purpose of using get_user_pages_fast() is to get at the mapping
> data without having to obtain the mmap_sem.
Thanks.
I understand. It's not only private futex.
>
>> Then, get_futex_value_locked calls __cpy_from_user_inatomic with
>> pagefault_disable.
>>
>> Who make sure the user page is mapped at app's page table ?
>
> Nobody, all uses of get_futex_value_locked() have to deal with it
> returning -EFAULT.
Does It mean that __copy_from_user_inatomic in get_futex_value_locked
would be failed rather than sleep?
In fact, I don't make sure _copy_from_user_inatomic function's meaning.
As far as I understand, It never sleep. It just can be failed in case
of user page isn't mapped. Is right ?
Otherwise, it can be scheduled with pagefault_disable which increments
preempt_count. It is a atomic bug.
If my assume is right, it can be failed rather than sleep.
At this case, other architecture implements __copy_from_user_inatomic
with __copy_from_user which can be scheduled. It also can be bug.
Hmm, Now I am confusing.
> Most of this is legacy btw, from when futex ops were done under the
> mmap_sem. Back then we couldn't fault because that would cause mmap_sem
> recursion. Howver, now that we don't hold mmap_sem anymore we could use
> a faulting user access like get_user().
> Darren has been working on patches to clean that up, some of those are
> already merged in the -tip tree.
Thanks for good information.
It will be very desirable way to enhance kernel performance.
> HTH
>
--
Kinds regards,
Minchan Kim
next prev parent reply other threads:[~2009-03-27 10:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-27 2:12 Minchan Kim
2009-03-27 4:32 ` Minchan Kim
2009-03-27 4:56 ` Eric Dumazet
2009-03-27 5:20 ` Minchan Kim
2009-03-27 5:50 ` Eric Dumazet
2009-03-27 6:20 ` Minchan Kim
2009-03-27 8:49 ` Peter Zijlstra
2009-03-27 10:56 ` Minchan Kim [this message]
2009-03-27 11:14 ` Peter Zijlstra
2009-03-27 11:37 ` Minchan Kim
2009-03-27 15:43 ` Darren Hart
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=28c262360903270356x6a9fc929m96941de8f8201fb0@mail.gmail.com \
--to=minchan.kim@gmail.com \
--cc=dada1@cosmosbay.com \
--cc=dvhltc@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®