mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle Moffett <mrmacman_g4@mac.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Dave Hansen <haveblue@us.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Pavel Emelyanov <xemul@openvz.org>,
	Ulrich Drepper <drepper@redhat.com>,
	linux-kernel@vger.kernel.org,
	"Dinakar Guniguntala [imap]" <dino@in.ibm.com>,
	Sripathi Kodi <sripathik@in.ibm.com>
Subject: Re: Futexes and network filesystems.
Date: Wed, 21 Nov 2007 01:16:27 -0500	[thread overview]
Message-ID: <79EA1EBC-895B-4AFC-92EB-05E46C6AAEF5@mac.com> (raw)
In-Reply-To: <m1ir3wr0jj.fsf_-_@ebiederm.dsl.xmission.com>

On Nov 20, 2007, at 17:53:52, Er ic W. Biederman wrote:
> I had a chance to think about this a bit more, and realized that  
> the problem is that futexes don't appear to work on network  
> filesystems, even if the network filesystems provide coherent  
> shared memory.
>
> It seems to me that we need to have a call that gets a unique token  
> for a process for each filesystem per filesystem for use in futexes  
> (especially robust futexes).  Say get_fs_task_id(const char *path);
>
> On local filesystems this could just be the pid as we use today,  
> but for filesystems that can be accessed from contexts with  
> potentially overlapping pid values this could be something else.   
> It is an extra syscall in the preparation path, but it should be  
> hardly more expensive the current getpid().
>
> Once we have fixed the futex infrastructure to be able to handle  
> futexes on network filesystems, the pid namespace case will be  
> trivial to implement.

Actually, I would think that get_vm_task_id(void *addr) would be a  
more useful interface.  The call would still be a relatively simple  
lookup to find the struct file associated with the particular virtual  
mapping, but it would be race-free from the perspective of userspace  
and would not require that we somehow figure out the file descriptor  
associated with a particular mmap() (which may be closed by this  
point in time).  Useful extension would be the get_fd_task_id(int fd)  
and get_fs_task_id(const char *path), but those are less important.

The other important thing is to ensure that somehow the numbers are  
considered unique only within the particular domain of a container,  
such that you can migrate a container from one system to another even  
using a simple local ext3 filesystem (on a networked block device)  
and still be able to have things work properly even after the  
migration.  Naturally this would only work with an upgraded libc but  
I think that's a reasonable requirement to enforce for migration of  
futexes and cross-network futexes.

Even for network filesystems which don't implement coherent shared  
memory, you might add a memexcl() system call which (when used by  
multiple cooperating processes) ensures that a given page is only  
ever mapped by at most one computer accessing a given network  
filesystem.  The page-outs and page-ins when shuttling that page  
across the network would be expensive, but I believe the cost would  
be reasonable for many applications and it would allow traditional  
atomic ops on the mapped pages to take and release futexes in the  
uncontended case.

Cheers,
Kyle Moffett


  reply	other threads:[~2007-11-21  6:17 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 14:43 [patch] PID namespace design bug, workaround Ingo Molnar
2007-11-01 14:51 ` Pavel Emelyanov
2007-11-01 14:56   ` Peter Zijlstra
2007-11-01 15:06     ` Pavel Emelyanov
2007-11-01 15:17       ` Ingo Molnar
2007-11-01 15:30         ` Pavel Emelyanov
2007-11-01 14:56   ` Ulrich Drepper
2007-11-01 15:05     ` Pavel Emelyanov
2007-11-02  0:21       ` Ulrich Drepper
2007-11-02  7:55         ` Pavel Emelyanov
2007-11-02  8:04           ` Andrew Morton
2007-11-02  8:14             ` Pavel Emelyanov
2007-11-02 14:05               ` Ulrich Drepper
2007-11-02 14:21                 ` Pavel Emelyanov
2007-11-02 15:34                   ` Ulrich Drepper
2007-11-02 15:58                     ` Pavel Emelyanov
2007-11-02 21:39                       ` Theodore Tso
2007-11-03  4:34                       ` Ulrich Drepper
2007-11-06  7:49                         ` Pavel Emelyanov
2007-11-03 20:01                   ` sukadev
2007-11-04  7:17                     ` Eric W. Biederman
2007-11-02 17:30             ` Dave Hansen
2007-11-02 17:39               ` Linus Torvalds
2007-11-03  4:02                 ` Nicholas Miell
2007-11-03 20:12                 ` Ingo Molnar
2007-11-03 22:40                   ` Linus Torvalds
2007-11-03 23:55                     ` Arjan van de Ven
2007-11-04  0:21                       ` david
2007-11-04 10:38                     ` [patch] PID namespaces Ingo Molnar
2007-11-04 20:12                       ` Dave Hansen
2007-11-05 14:47                       ` Denys Vlasenko
2007-11-20 22:53                   ` Futexes and network filesystems Er ic W. Biederman
2007-11-21  6:16                     ` Kyle Moffett [this message]
2007-11-21  6:30                       ` Eric W. Biederman
2007-11-01 16:12     ` [patch] PID namespace design bug, workaround Dave Hansen
2007-11-01 14:53 ` Ulrich Drepper
2007-11-01 15:05   ` Ingo Molnar
2007-11-01 18:57     ` Theodore Tso
2007-11-01 19:53       ` Ingo Molnar
2007-11-02  0:23         ` Ulrich Drepper
2007-11-01 15:02 ` Pavel Emelyanov

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=79EA1EBC-895B-4AFC-92EB-05E46C6AAEF5@mac.com \
    --to=mrmacman_g4@mac.com \
    --cc=akpm@linux-foundation.org \
    --cc=dino@in.ibm.com \
    --cc=drepper@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sripathik@in.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xemul@openvz.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®