Re: [PATCH] reducing overheads in fget/fput

From: Dipankar Sarma (dipankar@in.ibm.com)
Date: Fri May 02 2003 - 23:24:31 EST


On Fri, May 02, 2003 at 09:00:03PM -0700, Andrew Morton wrote:
> Dipankar Sarma <dipankar@in.ibm.com> wrote:
> > Not sure what your grouse is, but I don't like the fget_ligth()/fput_light
> > semantics myself. They don't seem natural, but I can't think of
> > better way to do this.
>
> Precisely.

I thought of doing something like -

static inline is_fds_shared(void)
{
        struct files_struct *files = current->files;
        return atomic_read(&files->count) != 1;
}

sys_blah(..)
{

        int fds_shared = is_fds_shared();

        file = fget_light(fd, fds_shared);
        ...
        ...
        fput_light(file, fds_shared);
}

It still didn't look very natural. We leave open the possibility of
users doing is_fds_shared() for both fget_light and fput_light.
With fput_needed flag, atleast we force them to use what is returned
by fget_light.

Thanks
Dipankar
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 07 2003 - 22:00:17 EST