[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwjaY6Nv7x0d8BQaSddZwAK7fukrYOHWEG_v2-1JZi5Qg@mail.gmail.com>
Date: Wed, 02 May 2018 04:14:41 +0000
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Dan Williams <dan.j.williams@...el.com>
Cc: "linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
Tony Luck <tony.luck@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>,
"the arch/x86 maintainers" <x86@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andy Lutomirski <luto@...capital.net>,
Ingo Molnar <mingo@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/6] use memcpy_mcsafe() for copy_to_iter()
On Tue, May 1, 2018 at 9:00 PM Dan Williams <dan.j.williams@...el.com>
wrote:
> >
> > I have some dim memory of "rep movs doesn't work well for pmem", but
does
> > it *seriously* need unrolling to cacheline boundaries? And if it does,
who
> > designed it, and why is anybody using it?
> >
> I think this is an FAQ from the original submission, in fact some guy
> named "Linus Torvalds" asked [1]:
Oh, I already mentioned that I remembered that "rep movs" didn't work well.
But there's a big gap between "just use 'rep movs' and 'do some cacheline
unrollong'".
Why isn't it just doing a simple word-at-a-time loop and letting the CPU do
the unrolling that it will already do on its own?
I may have gotten that answered too, but there's no comment in the code
about why it's such a disgusting mess, so I've long since forgotten _why_
it's such a disgusting mess.
That loop unrolling _used_ to be "hey, it's simple".
Now it's "Hey, that's truly disgusting", with the separate fault handling
for every single case in the unrolled loop.
Just look at the nasty _ASM_EXTABLE_FAULT() uses and those E_cache_x error
labels, and getting the number rof bytes copied right.
And then ask yourself "what if we didn't unroll that thing 8 times, AND WE
COULD GET RID OF ALL OF THOSE?"
Maybe you already did ask yourself. But I'm asking because it sure isn't
explained in the code.
Linus
Powered by blists - more mailing lists