Skip site navigation (1)Skip section navigation (2)
Date:      Mon,  6 Jul 2015 05:05:30 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        freebsd-fs@freebsd.org
Cc:        kib@freesd.org, rwatson@FreeBSD.org, Mateusz Guzik <mjg@freebsd.org>
Subject:   [PATCH 0/2] slightly cheaper file lookups + an idea
Message-ID:  <1436151932-12514-1-git-send-email-mjguzik@gmail.com>

next in thread | raw e-mail | index | archive | help
From: Mateusz Guzik <mjg@freebsd.org>

First, 2 simple patches which imho should go in regardless of whether
the idea below is accepted.

The first one shuffles code around to make the second one easier, which
removes a requirement to hold filedesc lock imposed by auditing.

With that out of the way:

filedesc lock is held so that fd_cdir and fd_rdir vnodes can be obtained
for lookup purposes. In effect namei unnecessarily competes with code
manipulating file descriptor table.

With patches mentioned here at the very least we can decompose the
filedesc lock into 2: one to protect fd_ cdir/jdir/rdir and the other
one for the rest.

However, I believe we should got a step further and split struct
filedesc instead. Specifically, we can move aforementioned vnodes to a
copy-on-write structure managed similarly to thread credentials.

After such an action there is no lock to take during lookups. Further,
since vnodes are guaranteed to be stable we don't have to vref+vrele any
of them, apart from the case where the vnode in question is going to be
returned.

This will make chdir more expensive, but file lookups are way more
frequent so it should be worth it.

Thoughts?

Mateusz Guzik (2):
  vfs: avoid spurious vref+vrele for absolute lookups
  audit: utilize vnode pointer found by namei instead of looking it up
    again

 sys/kern/vfs_lookup.c               | 129 ++++++++++++++++++++----------------
 sys/security/audit/audit.h          |  14 ++++
 sys/security/audit/audit_arg.c      |  36 ++++++++++
 sys/security/audit/audit_bsm_klib.c |  82 +++++++++++++++--------
 sys/security/audit/audit_private.h  |   2 +
 5 files changed, 178 insertions(+), 85 deletions(-)

-- 
2.4.5




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1436151932-12514-1-git-send-email-mjguzik>