Re: [patch] x86, mm: pass in 'total' to __copy_from_user_*nocache()




* Nick Piggin <nickpiggin@xxxxxxxxxxxx> wrote:

No I'm talking about this next case:

We can do little about user-space doing stupid things as
doing a big write as a series of many smaller-than-4K
writes.

Not necessarily smaller than 4K writes, but even as a series
of 4K writes. It isn't stupid thing to do if the source memory
is always in cache. But if you destination is unlikely to be
used, then you still would want nontemporal stores.

I dont disagree that it would be nice to handle that case too, i
just dont see how.

Unless you suggest some new logic that tracks the length of a
continuous write to a file, and whether it got read back
recently, i dont see how this could be done sanely.

That's the deal generally: if an app gives the kernel enough
information in a syscall, the kernel can act on it reasonably.

Sometimes, for important cases we allow apps to set attributes
that function across syscalls too - like here we could extend
madvise() to hint the kind of access ... but i doubt it would be
used widely.

Sometimes, for _really_ important cases the kernel will also try
to auto-detect patterns of use. We do that for readahead and we
do that for socket buffers - and a few other things. Do you
suggest we should do it here too?

Anyway ... i wouldnt mind if the lowlevel code used more hints
if they are present and useful.

And unlike the 'final tail' case which indeed was quirky
behavior and was worth fixing (hence the 'total' patch), the
'should the kernel detect many small writes being one real big
write' question is not a quirk but a highlevel question that the
lowlevel copy code (nor the lowlevel pagecache code) can answer.
So it's all a bit different.

The new numbers from Salman are convincing too - and his fix

I'm not exactly convinced. The boundary behaviour condition is
a real negative. What I question is whether that benchmark is
not doing something stupid. He is quoting the write(2)-only
portion of the benchmark, so the speedup does not come from
the app reading back results from cache. It comes from either
overwriting the same dirty cachelines (a performance critical
program should really avoid doing this if possible anyway); or
the cached stores simply pipelining better with non-store
operations (but in that case you probably still want
non-temporal stores anyway because if your workload is doing
any real work, you don't want to push its cache out with these
stores).

So, can we find something that is more realistic? Doesn't gcc
create several stages of temporary files?

i dont think this is really about performance critical apps, and
i suspect the numbers will be even more convincing if a read()
is inserted inbetween.

Lets face it, 99% of the Linux apps out there are not coded with
'performance critical' aspects in mind.

So what we have to do is to watch out for common and still sane
patterns of kernel usage - and optimize them, not dismiss them
with 'this could be done even faster with XYZ'. (As long as it
does not hurt sane usages - which i think this does not.)

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



Relevant Pages

  • Re: .DS_Store
    ... So I just note that OSX can't handle this, ... what apps won't work, it doesn't help. ... characters" that aren't examined or used by anything in the kernel. ... tests have shown that most unix kernels ...
    (comp.sys.mac.apps)
  • Re: objrmap-core-1 (rmap removal for file mappings to avoid 4:4 in <=16G machines)
    ... >> I agree that works fine for Oracle, that's becase Oracle is an extreme ... >> not the case of other apps, and those other apps really depends on the ... >> kernel vm paging algorithms for things more than istantiating a pte ... no zone-normal shortage at all that I can remeber, ...
    (Linux-Kernel)
  • Re: Is water cooling safe???
    ... I am a bit puzzled that you said you cant run all those apps at the ... should be power to spare. ... at once and that dont include having as many as 20 browser windows ... allow for the use of Dos, and I tend to still use many dos apps. ...
    (alt.comp.hardware.pc-homebuilt)
  • Re: [patch, 2.6.11-rc2] sched: RLIMIT_RT_CPU_RATIO feature
    ... You are right in that the individual workloads (e.g. ... it's about how all parts, softirqs, hardirqs, VM, etc... ... unconstrained, unlike dual kernel RT systems, across all component ... This is where properly written Linux apps (non exist right now because ...
    (Linux-Kernel)
  • Re: Video editing in Linux?
    ... >>code into the kernel (where its failure can bring down ... thing is they dont offer anything really over the command line way... ... total 20-500MB depending on what you install. ... if they are optional you wont but will suffer reduced functionality. ...
    (alt.linux)