Slashdot Mirror


Torvalds Has Harsh Words For FreeBSD Devs

An anonymous reader writes "In a relatively technical discussion about the merits of Copy On Write (COW) versus a very new Linux kernel system call named vmsplice(), Linux creator Linus Torvalds had some harsh words for Mach and FreeBSD developers that utilize COW: 'I claim that Mach people (and apparently FreeBSD) are incompetent idiots. Playing games with VM is bad. memory copies are _also_ bad, but quite frankly, memory copies often have _less_ downside than VM games, and bigger caches will only continue to drive that point home.' The discussion goes on to explain how the new vmsplice() avoids this extra overhead."

39 of 571 comments (clear)

  1. Wrong Side of Bed? by AKAImBatman · · Score: 5, Insightful
    Ok, let me see if I've got this straight:

    • Copy on Write saves you real memory, cache memory, and CPU time by pretending that each forked process has a true copy of a memory segment when it in fact is looking at the original. That is, right up until a fork tries to write to that memory location, in which case an exception is handled by making an actual copy to a new location and allowing the write.
    • Linus believes that the exception will occur enough in real world usage that it will be slower than just doing the copy in the first place.
    • Linus wants to push the manual use of zero-copy memory sharing through the vmsplice() routine. He believes that the programmer will always know better than the system when to share memory.
    • Linus doesn't like "VM Games" despite the fact that Virtual Memory, Memory Mapped Files, Disk I/O, Write Caching, etc, etc, etc, are all already "Memory Games" and "VM Games"


    Do I have that right?

    If so, I'm not really seeing his issue. Or at least not as hard-line as he sees it. The issue of memory copy performance is a tricky one, especially since CPU cycles are not the be-all to end-all of performance. Does the exception generated really cost that much more than he believes, or is it often eclipsed by the cost of the extra memory read/writes and CPU waits that are normally generated by a copy? Is it really feasible to expect program developers to do manual memory management in a day in age when programs easily weigh in at hundreds of megs?

    I'm just not sure that Torvalds is really looking at all sides of this. He may be right, but I'd like to hear more discussion between the *BSD guys and Torvalds before we put this matter to rest. And preferrably without the insults this time. :-/

    Links:

    Copy on Write as explained by Wikipedia
    FreeBSD page on Zero Copy Patches
    Duke Uni Research
    1. Re:Wrong Side of Bed? by qwijibo · · Score: 5, Insightful

      I don't consider myself an expert in kernel programming, but I definitely think someone is off base if they're expecting programmers as a whole to do the right thing. Many programs seem to work by coincidence rather than design. People didn't do their memory management right in the days when it was necessary. Now that a lot of people are moving towards languages that handle the memory management for them, I expect even fewer to worry about it. That does mean that the programmers of the programming languages are the ones who are responsible, but I'd personally rather have the kernel take a more active role in memory management.

    2. Re:Wrong Side of Bed? by mrsbrisby · · Score: 4, Insightful

      One thing that concerns me about making all of these copies is that it seems like a quick and easy way to blow out your L2 cache. That could in the long run have a worse performance penalty than having to play the VM tricks with CoW.

      No it won't. The only way to avoid the copies is to avoid the pagefaults. Since userland doesn't get explicit notification in FreeBSD of when the pages are safe to use, the process should wait as long as possible (e.g. until malloc() starts failing)

      The idea Linus pushes here is explicit notification- via select() or poll() and returnable via recvmsg(). That way the userland knows exactly which pages can be reused.

      The result is that it's faster and easier to develop userland programs to take advantage of it. It's also easier to degrade gracefully into read()/write() until the FreeBSD people see the light and add support for this too.

      It's really a clever idea.

    3. Re:Wrong Side of Bed? by Nato_Uno · · Score: 5, Insightful

      He doesn't care what the FreeBSD developers are doing... ... until someone advocates copying their ideas into the Linux kernel. Then he cares very much.

      He's not saying "The FreeBSD people should rewrite that part of their OS," he's saying "don't put that crap into the Linux kernel."

      --

      Have fun,

      Nathan 'Nato' Uno
      http://web.unos.net/
    4. Re:Wrong Side of Bed? by hackstraw · · Score: 3, Insightful

      One thing that concerns me about making all of these copies is that it seems like a quick and easy way to blow out your L2 cache. That could in the long run have a worse performance penalty than having to play the VM tricks with CoW.

      Right. Especially with multithreaded apps as Linus pointed out. Also the TLB misses could get expensive as well, and again the TLB misses will be more of an overhead with multithreaded apps.

      I don't believe that COW is completely evil. It exists, obviously for a reason, but I would agree with Linus on a much less harsh tone (depending on mood).

      Oh, and isn't "VM" a trick to begin with?

    5. Re:Wrong Side of Bed? by outZider · · Score: 5, Insightful

      Here's my -1, Troll.

      Funny that we just had an article about how many Linux users and enthusiasts exclude other people by being complete dicks, and here you are, acting like a dick. Of course, I don't know you from Joe Blow, so maybe I just misunderstood your obviously angsty response.

      "That's obvious."
      "Correction: when _you_ start using up a lot of memory Linux totally sucks. When I start using up a lot of memory, Linux acts exactly as I expect, and better than FreeBSD."

      Linux acts exactly how I'd expect, too. It completely sucks when it comes to memory and process management. Linux may have a better threading kernel, but that's the only thing that seems to save it in the real world. After only six years of administering servers professionally and for my own use, it has come down to Linux on the desktop, and FreeBSD for Real Work(tm). Many large companies that depend on their data agree with me, and those who use Linux or Windows just throw more machines at the problem.

      At least Linux is free compared to Windows, right?

      --
      - oZ
      // i am here.
    6. Re:Wrong Side of Bed? by thallgren · · Score: 2, Insightful

      > it has proved to be the right decision in the long-term.

      How can you say something like this? If Linux had a debugger from the start, it could be ripped out right now if there was some gain by doing that. By not having it, you only induced developers lots of pain during the last 10-15 years, for those occasions where a debugger really are the right tool for the job.

      And yeah, I know some of Linus' theories about how to program, how he thinks asserts and invariants are bad things, I just don't agree with him.

    7. Re:Wrong Side of Bed? by Just+Some+Guy · · Score: 4, Insightful
      No BSDer has been willing to reproduce the tests, as it will only confirm what the marketplace has already decided ... Linux is the superior OS.

      ...but still inferior to Windows, right? I mean, we're only looking at number of installations, after all. Furthermore, McDonald's clearly has the best hamburger and Velveeta beats Hoffman's Super Sharp.

      I like Linux. I'm typing this on a Gentoo box. However, I'd never pretend that it's better in every single aspect than any other OS in existence. The BSD guys have a few tricks up their sleeve, and even Redmond manages to get things right on rare occasion.

      --
      Dewey, what part of this looks like authorities should be involved?
    8. Re:Wrong Side of Bed? by Anonymous Coward · · Score: 1, Insightful

      That's exactly the problem with Linus' rant. He lambastes COW in general which is silly. zero_copy(9) is sufficently scarey that no sane programmer is going to say to himself "Oh, I'll add zero copy support and hope it makes things better".

    9. Re:Wrong Side of Bed? by larry+bagina · · Score: 2, Insightful
      I think the point is should the programmer be forced to allways have COW enabled or be able to choose.

      They already can choose. Kernel threads (via clone(2)) allow you to specify what (memory, files, signal handlers, etc) is cloned.

      Why fork? Because you're going to exec*(2) another program. Otherwise, you'd usually be better off using a thread.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

  2. Did you hear that? by DaHat · · Score: 1, Insightful

    It sounded like the opening volley of the second great Unix war, only this time instead of pitting proprietary Unix vendors and systems against each other... it is two open source ones.

    It will be interesting to see what weapon the BSD crowd will retaliate with.

    1. Re:Did you hear that? by TrappedByMyself · · Score: 2, Insightful

      It will be interesting to see what weapon the BSD crowd will retaliate with.

      I would just prefer that their response is to release a stable system using their method.

      --

      Help me take back Slashdot. When did 'News for Nerds' become 'FUD and Conspiracy Theories for Extremist Nutjobs'?
    2. Re:Did you hear that? by arosas · · Score: 2, Insightful

      With a comment like that, I can only imagine the kind of temper tantrum that Theo de Raat will throw. I mean honestly, whatever happened to common courtesy? There's no need for such comments like "incompetent idiots". I see so many people push for the advancement of OSS, only to find that it was in vain thanks to school-yard hissy fits like this.

  3. Linus is turning into a dictator by Anonymous Coward · · Score: 1, Insightful

    Maybe it's the stress, dunno but this guy is developing a chip on his shoulder that needs to be knocked off.

    In the spirit of open source community development, he can't make statements like this and expect to be a role model for the open source community.

    1. Re:Linus is turning into a dictator by Bogtha · · Score: 3, Insightful

      Dictator? Are the FreeBSD developers somehow unable to keep their implementation now that Linus deems it stupid?

      You might feel he's being a bit of an arsehole, but that doesn't mean he's a dictator. He's not stopping anybody from doing anything, he's merely sharing his opinion of a development technique on a mailing list dedicated to discussing the development of his kernel.

      --
      Bogtha Bogtha Bogtha
    2. Re:Linus is turning into a dictator by Lumpy · · Score: 5, Insightful

      No he is simply getting less tolerant of "sloppy" programming. He is one of the very very few that believes in doing it the way that gives you the best speed. Something that takes 4+ operations compared to a way of doing it with only 2 operations and you get less problems = performance gains that add up. Just because your typical machine has 4 dual core 8Ghz processors and 22 terabytes of ram does not mean you can slack off and write the whole thing without paying attention to performance.

      the BSD guys have their reasoning and if you read more info about this it is not a shot in the dark that Linus is taking but he is frustrated that after many discussions nobody cares as much as he does on the performance issues.

      Go back and read what Linus did back in the early days, it's no different today than what it was in 1990, he will call a duck a duck.

      --
      Do not look at laser with remaining good eye.
    3. Re:Linus is turning into a dictator by Anonymous Coward · · Score: 1, Insightful
      How about proving Linus wrong, or shutting up and keeping a respectful distance where kernel affairs are concerned like the rest of us.

      Touchy-feely happy time doesn't belong in the most critical part of an OS. This is where you put up or shut up. There aren't a lot of people who can do this kind of work, but an army of people who want to waste time trying to glom on and "belong" to the culture. They're a liability, and it's a good thing to have the kind of attitude that shakes them off. Mind: I'm not saying the BSD developers are glomming. But if you've seen their mailing lists, you know that they're just as bullshit-free and will take this as a challenge and change FreeBSD or prove Linus wrong. They won't just whine about it like a bunch of little girls.

    4. Re:Linus is turning into a dictator by rtaylor · · Score: 4, Insightful

      No he is simply getting less tolerant of "sloppy" programming.
      You'll forgive me for taking that with a grain of salt so long as memory over-commit remains the default mode of operation within Linux.

      --
      Rod Taylor
    5. Re:Linus is turning into a dictator by Laser+Lou · · Score: 2, Insightful

      Linus long been called a "Benevolent Dictator for Life". I guess this supports the idea that, with all dictatorships, you get more that what you bargained for.

      --
      No data, no cry
  4. Linus needs a cup of 'nice' by guysmilee · · Score: 1, Insightful

    What is with this guy slamming on people. I am sure he's bright and all but would it hurt him to try and be constructive instead of just being rude. He could simply provide a example of what problems will occur and then stop.

  5. Solaris... by Anonymous Coward · · Score: 1, Insightful

    Solaris 10/11 and openSolaris are looking better each and everyday

  6. Re:Hmm, where have I heard this recently? by dow · · Score: 3, Insightful

    Are the *BSD people are nicer? Or at least more tactful?

    No. Thats why there is more than one BSD. Issues come up, and booom crash goes the fork. Pity.

  7. Linus sometimes calls people idiots by cpu_fusion · · Score: 4, Insightful

    And in other news...
    Grass is green;
    Oil is overpriced;
    Absolute power corrupts absolutely.

  8. He's just a developer by krewemaynard · · Score: 3, Insightful

    Here we go again, imposing "role model" status. Linus is just a guy. Sometimes he gets his buttons pushed, sometimes he's doing the pushing. BFD. Maybe you'd be a little pissy too if Slashdot posted a story every time you did or said something. Linus Prefers Gas-X, Says Bean-o Is For Douchebags. Who cares? (BTW, Linus didn't really say that, I made it up. Don't wanna get the Bean-o people on his case too.)

    As far as this whole VM thing goes, time and testing will tell the true story. Meanwhile, maybe we could try NOT deifying Linus (any more)?

    --
    I saw it on Slashdot, it must be true!
  9. Just say what you mean by lymond01 · · Score: 3, Insightful

    "I claim that Mach people (and apparently FreeBSD) are incompetent idiots."

    Linus, who's becoming more outspoken as he ages, needs to find that line between anonymous forum geek and software spokesperson...and then not cross it. Calling anyone an incompetent idiot is both non-constructive if you're hoping to improve a situation, and just plain unfriendly in an area where cooperation amongst developers is so crucial (open source).

  10. Re:Yeah, that's a bad idea. It's been tried. by n8_f · · Score: 2, Insightful
    I don't know about the rest of your post, but your explanation of CoW is confusing and inaccurate:

    The basic idea is to fake some memory to memory copying operations by using the virtual memory hardware. More specificially, the idea is that when you do a big "write", the space just written becomes read-only to the writing process, rather than being actually copied. When the write is complete, read-only mode is turned off. This eliminates one copy.

    The way CoW works is that when a process copies something already in memory, the kernel has the MMU map those same memory pages to a new location in the process' address space and mark them as read-only, after which the kernel returns the address of the "copied" memory to the process. When any of the processes using that memory try to write to it, the MMU generates an exception (because the pages are marked read-only). The kernel intercepts the exception, allocates additional memory and copies the pages being written to into it, has the MMU remap that process' address space to point to those pages, and then proceeds with the write.

  11. Lesson on Tact.. by corellon13 · · Score: 3, Insightful

    Linus, you may be right and you may be very smart, but you should try a little tact. Here's a good definition for it that I learned from a drill sergeant: "Tact is the ability to tell someone to go to hell and look forward to the trip."

    Being nice and respectful doesn't mean you can't tell it like it is.

    --
    Do what is right and let the consequence follow
  12. Flame war article by Anonymous Coward · · Score: 1, Insightful

    Why not focus on the real content instead of write tabloid style articles.

  13. He has the stones to back it up by Gothmolly · · Score: 3, Insightful

    Linus has frequently called people idiots, and ignored patches, and done stuff his own way for a very long time now. He's quite successful at it. Perhaps what most people need to realize is that he is that good, that he can. The average read-Slashdot-during-work-while-coding Slashdotter is not in his league, so decrying his adhominem attacks, or "I would do X instead" arguments just dont hold much water.

    --
    I want to delete my account but Slashdot doesn't allow it.
  14. Funny by dnaumov · · Score: 1, Insightful
    "Linus: Playing games with VM is bad."

    Funny you should say that Linus, seeing how much of a fucking disaster was changing the VM in the middle of the 2.4 kernel branch that is supposed to be STABLE.
  15. Re:Wrong side of compiler by arivanov · · Score: 5, Insightful

    More likely he had some really bad acid the previous night.

    After all he did more than 6 revisions of the Linux VM using CopyOnWrite before this latest fad.

    Possibly more.

    Off the top of my head that is at least 1 in the 1.2 tree, 1 in the 2.0 tree, 1 in the 2.2 tree, 2 in the 2.4 tree and more than 2 in the 2.6 tree, all of which being CopyOnWrite and at least some of which has been hailed as the next best thing after hot bread.

    As far as the technical point he is possibly correct for x86 where COW goes through the fault mechanism and causes some TLB and cache abuse which is really bad on modern CPUs. I am not sure as far as other architectures are concerned, because IIRC (I may be wrong) the memory mapper hardware on the old Sparc was designed for COW in first place.

    Anyway, before calling somebody else an idiot for something you have happily done for 10+ years till yesterday it may be nice if you look at yourself in the mirror. Because I never remember any branch of FreeBSD reaching the point where you can do a find /usr -exec cat {} > /dev/null \; to hang the system. That is 2.6.16 at your service (from rc4 onward) on at least two x86 subarchitectures where I had the time to test it. That is besides the unkillable processes in [S] state on an nfs flock in 2.6.14 (yep, that is a gem which no other unix has managed so far), besides the OOM idiocies in 2.6.10, besides deliberately making it absolutely impossible to backtrack any more interesting patch to a previous kernel without employing a team of kernel developers because the VM and locking is not compatible across any kernel version since 2.6.9 and even when it is something else is changed like the tty layer, besides.... Aarghh.....

    --
    Baker's Law: Misery no longer loves company. Nowadays it insists on it
    http://www.sigsegv.cx/
  16. A problem of read()/write() semantics, not VM? by KonoWatakushi · · Score: 2, Insightful

    I can certainly see the value in explicit notification of page usage, but I have to wonder if this isn't attacking the problem at the wrong level. It seems that these problems are caused by the semantics of read() and write() calls, requiring data to be read/written to an arbitrarily aligned userspace buffers.

    Zero copy can definitely make things complex, and in the current implementations, the value is arguable. (and being argued...) Still, memory copies have an associated cost. While they may be better than COW with explicit notification, it is still a performance hack, and represents a non-optimal way of dealing with data transfers. (It could be the easiest and best hack to be made, I can't say. In any case, Linus is acting like a git with his name calling here.)

    Perhaps more consideration should be given to the API instead. Using zero copy is obviously a good goal, and it is primarily hindered by the ancient API and protocols. Something where the buffer management is explicit, and the devices themselves actually own the them. (After all, they are the only entities which know what the buffer requirements are.) Arranging it so that the user applications have access to the actual network buffers would be far preferable to playing any of these "games".

    Unfortunately, Ethernet and the IP protocols are not particularly conducive to such an optimal implementation. With enough intelligence in the network adapters though, many of the issues should be manageable, and allow for a good zero copy implementation with a suitable API. It may be more trouble for the application, but if you need the performance, it is a small price to pay.

  17. Re:Wrong side of compiler by Anonymous Coward · · Score: 2, Insightful

    I just don't seem what the big deal is with Linus's comment. Of course I'm an OpenBSD person, and can hardly consider a mere 'incompetent idiots' to be a serious disparagement.

  18. What harsh words? by Inoshiro · · Score: 5, Insightful

    Andy went out and said that he thought the Linux approach was wrong, and archaic, and that people should go and wait for GNU.

    Linus said that he felt this was wrong, and that being a prof is no excuse for Minix being the mess it was (and Minix was a mess in the late 1980s/early 1990s). He also apologized if he came off as too harsh for his writing about how people should be able to throw away an old design in favour of a new one anyway, etc.

    It was very polite compared to some of the non-Andy/Linux replies.

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
  19. Re:Wrong side of compiler by WgT2 · · Score: 2, Insightful

    I'm not too surprised, as he seems to be somewhat of a visionary: he see things as he thinks they should be... and explodes when they aren't. ;)

    What I don't get is why he choose to use incompetent to describe a group of people who are not implementing something he is just now implementing himself.

  20. It's not the only problem of TLB. by Anonymous Coward · · Score: 2, Insightful
    The COW problems:
    1. The #1 problem: many context switches to issue each miss of the i-want-write-to-the-marked-protected-page. Solution: few context switches copying more if overneed.
    2. TLB misses.
    3. L1 & L2 Cache misses.
    4. Double TLB misses, one in userspace and other in kernel space.
    5. L1 & L2 Cache misses, one in userspace and other in kernel space.
    6. Multithreading locks (mutexes, semaphores, blocking calls, non-blocking calls, ...) VERSUS NO-locks in monothreading using select/poll, non-blocking calls, ...
    7. Hardware bubbles: pipeline's misses & bubbles, big page-translation bubbles, ...

    -=- ThE DaRK MaN oF tHe ObScURiTY -=-

  21. Re:RTFA, please. Or at least my summary here. by joe_bruin · · Score: 3, Insightful

    Thank you. I've read more than 30 high-modded posts in this article, and yours is the best explanation of the issue by far.

  22. Re:RTFA, please. Or at least my summary here. by menace3society · · Score: 2, Insightful

    So the big question is, what happens if user mode breaks the promise, either intentionally or through lousy programming? If the program fucks up, well, then, I'd rather have FreeBSD's model (actually, I'd rather have someone come up with a thread-safe wrapper function, and keep I/O the way it's supposed ot be, i.e., atomic).

  23. Re:RTFA, please. Or at least my summary here. by menace3society · · Score: 2, Insightful

    I'm sure someone said the same thing about the total size of segmented ICMP packets.