On 07/15, Paul E. McKenney wrote:
>
> On Wed, Jul 15, 2015 at 08:15:11PM +0200, Peter Zijlstra wrote:
> >
> > No, it makes the read-side primitive contain an unconditional memory
> > barrier, that forgoes the entire point.
> >
> > The writers are stupidly expensive already for they need global
> > serialization, optimizing them in any way doesn't make sense.
>
> That could well be the case, but it would be good to see the numbers.

Please see the discussion in another "change sb_writers to use
percpu_rw_semaphore".

The simple test-case from Dave

        #include <fcntl.h>
        #include <stdlib.h>
        #include <unistd.h>
        #include <string.h>
        #include <assert.h>

        #define BUFLEN 1
        #define FILESIZE (1 * 1024 * 1024)

        char *testcase_description = "Separate file write";

        void testcase(unsigned long long *iterations)
        {
                char buf[BUFLEN];
                char tmpfile[] = "/run/user/1000/willitscale.XXXXXX";
                int fd = mkstemp(tmpfile);
                unsigned long size = 0;

                memset(buf, 0, sizeof(buf));
                assert(fd >= 0);
                unlink(tmpfile);

                while (1) {
                        int ret = write(fd, buf, BUFLEN);
                        assert(ret >= 0);
                        size += ret;
                        if (size >= FILESIZE) {
                                size = 0;
                                lseek(fd, 0, SEEK_SET);
                        }

                        (*iterations)++;
                }
        }

runs 12% faster if we "simply" remove mb's from sb_start/end_write().
percpu_rw_semaphore does this too and has the approximately same
performance, and we can (hopefully) remove this nontrivial, currently
not 100% correct, and very "special" code in fs/super.c.

Oleg.

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

Reply via email to