8 ms·
Ok, so how you would write this (at least the first section, explaining the error) constructively could be much shorter. "The author of that post has a common
by asdfasgasdgasdg 7y ago
Ok, so how you would write this (at least the first section, explaining the error) constructively could be much shorter.
"The author of that post has a common misconception, which is that spin locks are a fast drop in replacement for uncontended mutexes. They aren't. You can only use them well when you know you won't be descheduled, like we do in the kernel. In a generic userspace program, you don't have that knowledge. The possibility of your time slice ending skews all the time measurements, for example."
Boom. Roughly the same message. Most people will get the same amount of edification from this as Linus' original letter. You could go in to more detail if you want but it's not really necessary. Smart people will figure it out if you just point out the general shape of the error. No need for calling code "garbage."
- csande17 7y agoI personally really appreciated the additional details in Linus's version. When I read your version, I learn that spin locks are not a drop-in replacement for uncontested mutexes. That's great, except that I don't really know for sure what either of those terms mean, and also I didn't gain any knowledge that doesn't relate to this specific situation. It also wasn't super convincing -- I could just as easily see someone post a reply saying "well actually spin locks ARE a drop-in something something mutex" and I'd have no way to tell who was right. Linus, on the other hand, told me about the mechanism by which the problem happens. I learned about how the scheduler sees spin-locks' loops, and that the main advantage of "real" mutexes is that the scheduler knows who's waiting on what. I also wouldn't necessarily have realized the "take clock measurement, then get descheduled before you release the lock" issue if he hadn't called it out specifically. Sure, I guess "garbage" comes off a little mean, but "the author has a common misconception" almost sounds more passive-aggressive to me.
- simias 7y agoThe first section of Linus's answer reads really rough to me and almost made me stop reading, imagining that it was going to be yet an other entry in the "Linus bullies some poor coder into submission by insulting them until they just stop responding" which is a shame because there's a lot of interesting content after that. I guess I invite the people who had the same knee-jerk reaction I had to give the post a 2nd chance and power through Linus' unnecessarily harsh tone to get to the good stuff. >Sure, I guess "garbage" comes off a little mean, but "the author has a common misconception" almost sounds more passive-aggressive to me. The latter might be slightly passive-aggressive (although it doesn't have to be), the former is simply aggressive-aggressive.
- needs 7y agoAs long as Linus is blaming the work done and not the people behind it, that's fine. Something truly aggressive would be "This benchmark is garbage and the people responsible for writing it are monkeys on crack". He did such things in the past, but in the 4 emails I got to find on this specific benchmark, none of them critic people writing code. I think Linus got upset that a badly designed benchmark got popular and therefor is spreading misconceptions. His strongly worded answer is getting popular too and as a result everybody learns and he has stopped an urban legend from spreading. A success on every points.
- speedplane 7y ago> As long as Linus is blaming the work done and not the people behind it, that's fine. Certainly, ad hominem attacks are worse than making substantive attacks, but is that really the standard we should judge it by? Instead of a sprawling thread of visceral, wouldn't it be better if he just explained the reasons why the approach is bad in a professional manner? Writing like this just seems sloppy and non-professional. It's rambling and unclear. It could have been far more effective if written point-by-point with far less emotion.
- xelxebar 7y agoCalling out non-professionalism and bashing a stranger's communication style are, perhaps ironically, nice examples of non-professional behavior. I would answer your rhetorical questions with an emphatic "no." People's emotions and mental state are important. It's also important that we communicate, understand, and think about people's interior worlds. Question for you: What else is Linus communicating with his writing style? Does he show that he cares? About what? What can we tell about his values? Are these values we want in a leader? Sometimes it's good to take off the prescriptivist hat and try on Honest Curiosity.
- loopz 7y agoIf what you're measuring are random delays due to default scheduling and flawed code implementation, calling it "garbage" should give the author and others pause to think. In some cases, one need to establish a boundary, so as to not waste time and efforts into an endless discussion on flawed premises. Explaining why and educating about the concepts, is the better approach, and was there as well. Short and concise would be best, while limiting the negative to exactly what need be pointed out: A spade is a spade after all. If it stops people from developing "their own userspace spinlocks", it may even be kind of necessary to be quite direct.
- kbumsik 7y agoI'm favor of Linus version. They are not the same message to me. He clearly explains what really would happen behind the scene.
- buzzkillington 7y ago>Boom. Roughly the same message. Most people will get the same amount of edification from this as Linus' original letter. You could go in to more detail if you want but it's not really necessary. Smart people will figure it out if you just point out the general shape of the error. No need for calling code "garbage." People should be shamed for being ignorant. It stops ignorance from spreading.
- dochtman 7y agoI guess we should shame you for being ignorant about human beings and the value of being kind. There are plenty of ways to point out ignorance without being unkind (and the grandfather comment is a nice attempt).
- buzzkillington 7y agoYou just did, and got to pretend you didn't.
- simias 7y agoIgnorance is the lack of knowledge, it doesn't "spread" like a disease. Misconceptions can, but without the original author's mistakes we wouldn't have this rebuttal by a very knowledgeable actor, so overall this is a net positive including for you and me.
- celticmusic 7y agomisconception is a form of ignorance.
- simias 7y agoAnd so is not reading the second half of comments.
- celticmusic 7y agoYour "correction" literally explained the comment it was correcting as being true. reacting in a haughty manner doesn't stop you from being wrong, it just makes you a dick.
- SergeAx 7y agoIn CS "garbage" has a bit different sounding, like in "garbage collector". Nonetheless, original poster started it, writing an article "Why Linux scheduler is bad". Next time he'll see it coming. By the way, Linus' answer is much more informative than yours. I got a lot of useful insights from it and had fun just reading his lively language.
- kelnos 7y ago> In CS "garbage" has a bit different sounding, like in "garbage collector". It's a bit disingenuous to suggest that Torvalds meant it in that sense, though. He very obviously meant it in the sense of a piece of trash that should be thrown into a trash bin.
- SergeAx 7y agoOr a piece of code that doesn't do anything useful or meaningful and may be skipped by compiler as well.
- loopz 7y agoCompiler warning: Sourcecode classified as "garbage". Replaced with NOP for user protection.
- clarry 7y agoGarbage code sounds like a fine new class of undefined behavior to add to the next C standard. You just need to teach ubsan to understand it.
- kelnos 7y agoNo, he very clearly meant the definition I suggested. (Also I've never heard of dead code referred to as "garbage code".)
- thenewnewguy 7y ago> No need for calling code "garbage." In my opinion calling the code garbage is much nicer than "The author of that post has a common misconception", which sounds like a passive-aggressive way to call someone dumb. Everyone writes bad/'garbage' code once in awhile.
- 0xBA5ED 7y ago>"The author of that post has a common misconception", which sounds like a passive-aggressive way to call someone dumb Not at all. It's a polite way to say they're ignorant of a particular thing. It would be rather insecure of them to read into it and think they're being called dumb across the board.
- csande17 7y agoWhen you say "the code is bad/wrong/garbage", that's a statement about the code. It gives the person who wrote it an out: they can say "Oh, right, I totally knew that, just slipped my mind for a second", or "This is why I shouldn't write blog posts about mutexes at 3 AM" or something. I've certainly written garbage code at times, and you probably have too -- it doesn't mean you're dumb or you don't know things. When you say "the person who wrote this code has a common misconception", that's a statement about the person. You've jumped to a conclusion about the reason the person wrote the bad code. You're telling the person to accept that they don't know as much about mutexes as you, that they're ignorant, that they're a worse programmer (albeit in a fairly narrow category). This is why I think GP's wording comes off worse even though it's superficially more polite.
- 0xBA5ED 7y agoOn the other hand, I wouldn't get offended if someone said a piece of my code indicated I was ignorant of something. If I was ignorant, I'd fess up to it no problem. Or if I had reasons for intentionally doing it a different way, I'd share and let someone school me if they had a point on why I was wrong. Ego sensitivity only causes problems. It never solves them. Additionally, _sometimes_ offering someone an out to save their ego actually does them a disservice.
- flafla2 7y agoI disagree with this sentiment. Linus' answer not only describes the immediate bug, but also gives enough detail and context that other, similar potential bugs related to the scheduler may be avoided after having read the entire post. Also I don't think Linus is being egregiously impolite in his post; he isn't calling the author of the post garbage. Calling the code garbage is not a personal affront, but an objective statement to dissuade others from being misled. If this was a truly idiotic / trivial mistake I doubt Linus would put much thought or time into such a long post. I also think that if you are going to write a blog post, you are implicitly supposing a place of authority and therefore opening yourself to criticisms. In other words, writing a blog post that is incorrect (in this case, very incorrect) is actively harmful as it misleads others, and it is important to call out wrong posts when necessary. I've posted dumb advice with a know-it-all voice before too (see [1] for an embarrassing HN comment) and I am not at all angry/annoyed that I was similarly called out. [1] https://news.ycombinator.com/item?id=20017832 https://news.ycombinator.com/item?id=20017832 (edit: wrong link)
- emily-c 7y agoIt's important to realize that you are not your code. Linus' reply comes off as passionate but he clearly cares enough to write such a detailed response.
- kstenerud 7y agoYes, Linus can still be abrasive, but he's gotten a LOT better than he was before his road to Damascus moment.
- bitwize 7y agoYou mean his struggle session.
- Dylan16807 7y ago> The possibility of your time slice ending skews all the time measurements, for example." If you were forced to summarize the entire first third of the email into ten words, that might be valid. As-is, it's way too short to be a proper explanation. It's more of a reminder note. If someone doesn't know exactly what you mean at a single glance, it's useless. Linus has an actual explanation in his email.
- rdiddly 7y agoAt least it's not "total fucking braindamaged garbage." Progress?
- nemetroid 7y agoThis is all in response to a blog post titled ”Measuring mutexes, spinlocks and how bad the Linux scheduler really is”. Based on the content and tone of that post, I think Linus’s tone is fair.
- tyingq 7y agoI immediately thought of his lkml email where he reflected on this kind of thing: https://lore.kernel.org/lkml/CA+55aFy+Hv9O5citAawS+mVZO+ywCKd9NQ2wxUmGsz9ZJzqgJQ@mail.gmail.com/ https://lore.kernel.org/lkml/CA+55aFy+Hv9O5citAawS+mVZO+ywCK...
- mda 7y agoYour version lacks depth and I appreciate Linus's response. Imo, he can call something garbage if the mentioned garbage makes false and bold claims about his and contributors decades of work.
- bryal 7y agoHe probably just didn't take very kindly to the Linux scheduler being called "bad" in the blog post, when tons of people have spent an immense amount of time on it, and there are in fact good reasons for it behaving the way it does. If I were in the same seat, I'd be pretty stingy with the politeness as well.
- uasm 7y agoYou're not saying the same thing, and your version sounds like BigCorp PC talk - regurgitated and self-censored. What makes you feel entitled to go around "re-writing" comments/posts made by others?