public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, torvalds@osdl.org
Subject: [PATCH 0/3] *at syscalls: Intro
Date: Thu, 15 Dec 2005 17:49:33 -0500	[thread overview]
Message-ID: <200512152249.jBFMnXAA016747@devserv.devel.redhat.com> (raw)

Here is a series of patches which introduce in total 11 new system calls
which take a file descriptor/filename pair instead of a single file name.
These functions, openat etc, have been discussed on numerous occasions.
They are needed to implement race-free filesystem traversal, they are
necessary to implement a virtual per-thread current working directory
(think multi-threaded backup software), etc.

We have in glibc today implementations of the interfaces which use the
/proc/self/fd magic.  But this code is rather expensive.  Here are some
results (similar to what Jim Meyering posted before):

The test creates a deep directory hierarchy on a tmpfs filesystem.
Then rm -fr is used to remove all directories.  Without syscall support
I get this:

real    0m31.921s
user    0m0.688s
sys     0m31.234s

With syscall support the results are much better:

real    0m20.699s
user    0m0.536s
sys     0m20.149s


The implemenation is really small:

 arch/i386/kernel/syscall_table.S |   11 ++
 arch/x86_64/ia32/ia32entry.S     |   11 ++
 fs/compat.c                      |   48 +++++++++--
 fs/exec.c                        |    2 
 fs/namei.c                       |  167 ++++++++++++++++++++++++++++++---------
 fs/open.c                        |   60 +++++++++++---
 fs/stat.c                        |   54 ++++++++++--
 include/asm-i386/unistd.h        |   13 ++-
 include/asm-x86_64/ia32_unistd.h |   13 ++-
 include/asm-x86_64/unistd.h      |   24 +++++
 include/linux/fcntl.h            |    7 +
 include/linux/fs.h               |    7 +
 include/linux/namei.h            |    7 -
 include/linux/time.h             |    2 
 14 files changed, 355 insertions(+), 71 deletions(-)

I've split the patch in three parts.  The first part is the actual
code change.  It mostly consists of passing down an additional parameter
with a file descriptor and add wrapper functions which pass down the
default parameter AT_FDCWD.  Three new constants are defined in
<linux/fcntl.h> which must correspond to the values already in use
in glibc.  In a few cases I've modified some code which would not
necesarily need changing but the change makes it a bit more efficient
in presence of the wrapper functions.

The real change needed is the additional else-clause in what is now
do_path_lookup.  That's it.

The other two patches contain the syscall definitions for x86 and x86-64.
I've tested the code on x86-64, including the ia32 compat code.  Because
there is no architecture specific change all should work well on other
archs once the syscalls are added.

             reply	other threads:[~2005-12-15 22:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-15 22:49 Ulrich Drepper [this message]
2005-12-16  0:32 ` [PATCH 0/3] *at syscalls: Intro Jeff Garzik
2005-12-16  1:29   ` Ulrich Drepper
2005-12-16  1:39     ` Jeff Garzik
2005-12-16 11:32   ` Jim Meyering
2005-12-16 16:24     ` Ulrich Drepper
2005-12-16 16:36       ` Jakub Jelinek
2005-12-16 19:59       ` Jim Meyering
2005-12-16  1:13 ` Nicholas Miell
2005-12-16 17:51   ` Linus Torvalds

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=200512152249.jBFMnXAA016747@devserv.devel.redhat.com \
    --to=drepper@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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