linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@gmail.com>
To: david singleton <dsingleton@mvista.com>
Cc: akpm@osdl.org, mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [robust-futex-3] futex: robust futex support
Date: Tue, 17 Jan 2006 09:50:46 -0800	[thread overview]
Message-ID: <a36005b50601170950u307ffb9dl52dc3655a1b90fa6@mail.gmail.com> (raw)
In-Reply-To: <C59522FA-8700-11DA-B27C-000A959BB91E@mvista.com>

And another thing: semaphores are on their way out.  So, in
futex_deregister and in futex_head, shouldn't you use mutexes?  I
don't see that you realy need semaphores.

In futex_register, you define mm and initialize it with current->mm. 
That's OK.  But why then are you using

+       down_read(&current->mm->mmap_sem);

just a few lines below?

And finally (for now): in get_futex_key the VMA containing the futex
is determined.  And yet, in futex_register you have an identical
find_extend_vma call.  I don't know how expensive this function is. 
But I would assume that at least the error handling in futex_register
can go away since the VMA cannot be torn down while mmap_sem is taken,
right?  But perhaps this just points to more inconsistencies.  Why is
the list/sem lookup in get_futex_key?  Only to share the code with
futex_deregister.  But is that really worth it?  The majority of calls
to get_futex_key come from all the other call sites so the code you
added is only a cost without any gain.  Especially since you could in
futex_register do the whole thing without any additional cost and
because most of the new tests in get_futex_key are again tested in
futex_register (to determined shared vs non-shared) and do not have to
be tested in futex_deregister (we know the futex is in shared memory).

I suggest that if find_extend_vma is sufficiently expensive, pass a
pointer to a variable of that type to get_futex_key.  If it is cheap,
don't do anything.  Pull the new code in get_futex_key into
futex_register and futex_deregister, optimize out unnecessary code,
and merge with the rest of the functions.  It'll be much less
invasive.

  parent reply	other threads:[~2006-01-17 17:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-14  1:00 [robust-futex-1] futex: robust futex support David Singleton
2006-01-15  0:02 ` Ulrich Drepper
2006-01-15  0:04   ` david singleton
2006-01-15  5:18     ` Ulrich Drepper
2006-01-15 20:00       ` David Singleton
2006-01-17  2:27       ` [robust-futex-3] " david singleton
2006-01-17 17:32         ` Ulrich Drepper
2006-01-17 17:50         ` Ulrich Drepper [this message]
2006-01-19  2:26           ` [robust-futex-4] " david singleton
2006-01-19  5:22             ` Andrew Morton
2006-01-20  0:47               ` [robust-futex-5] " david singleton
2006-01-20 17:41               ` [robust-futex-4] " Ingo Oeser
2006-01-20 22:18                 ` Andrew Morton
2006-01-21  2:30                   ` david singleton
2006-01-23 18:20               ` Todd Kneisel

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=a36005b50601170950u307ffb9dl52dc3655a1b90fa6@mail.gmail.com \
    --to=drepper@gmail.com \
    --cc=akpm@osdl.org \
    --cc=dsingleton@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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;
as well as URLs for NNTP newsgroup(s).