Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Red Hat Software Linux

Alternative To the 200-Line Linux Kernel Patch 402

climenole writes "Phoronix recently published an article regarding a ~200 line Linux Kernel patch that improves responsiveness under system strain. Well, Lennart Poettering, a Red Hat developer, replied to Linus Torvalds on a mailing list with an alternative to this patch that does the same thing yet all you have to do is run 2 commands and paste 4 lines in your ~/.bashrc file."
This discussion has been archived. No new comments can be posted.

Alternative To the 200-Line Linux Kernel Patch

Comments Filter:
  • Comment removed (Score:2, Insightful)

    by account_deleted ( 4530225 ) on Thursday November 18, 2010 @07:07PM (#34275876)
    Comment removed based on user account deletion
  • by Meshach ( 578918 ) on Thursday November 18, 2010 @07:14PM (#34275964)

    Is there a catch?

    Yes. To quote Linus:

    User-level configuration for something that should just work is annoying. We can do better.

    I think I will use an actual kernel patch rather then this hack in user space.

  • by Lemming Mark ( 849014 ) on Thursday November 18, 2010 @07:22PM (#34276064) Homepage

    This isn't a nasty hack like some userspace bodges round kernel problems can be. The functionality to schedule the CPU in controlled ways to different groups of processes has been in the kernel for some time now and simply needs configuring from userspace. The 200 line patch adds some default configuration of this mechanism to the kernel; this alternative uses the existing functionality to do the same thing. The same kernel mechanism should end up handling it.

    It's good if the kernel can do more stuff so that the user doesn't have to - where it makes sense. But this is actually a reasonably neat solution if you want the same behaviour without upgrading your kernel.

  • by MBCook ( 132727 ) <foobarsoft@foobarsoft.com> on Thursday November 18, 2010 @07:37PM (#34276292) Homepage

    The kernel has a mechanism to schedule groups of processes, and it has for years. By grouping tasks together, you can make one process (video playing) get the same cpu share as a group of processes put together (compiling code). By doing this (instead of the video processing being equal to just one of the compiling processes), everything feels more interactive, even though it's actually slightly slower.

    No one uses scheduling groups because they have to be setup by root and it's not the easiest thing in the world (you have to write stuff into sysfs, I think). No distributions set them up.

    The magic kernel patch just adds a simple rule to the scheduler. When a process starts, it goes into a group with the rest of the processes in that TTY (virtual terminal). This means the user doesn't have to do anything and the groups are setup automatically.

    Poettering thinks this is somewhat hackish, and that things shouldn't be based on what TTY a process is started on. He made the little script to prove that this can easily be done in userspace.

    Linus has rejected this, basically saying that we've had years for people to make something like this and no one did until the kernel patch came along. The patch is simple, reasonable, and doesn't require distributors to ship updated userland files to put processes in groups.

    I should note that my understanding comes from LWN [lwn.net], which has had excellent coverage of this on their kernel page, as always. You'll be able to see their articles in two weeks if you're not a member (which is worth it if you like this kind of stuff).

  • by Shimbo ( 100005 ) on Thursday November 18, 2010 @07:54PM (#34276494)

    True, though it could be done at the distro level, which appears to be the author's plans (the person who wrote this script works for Red Hat, and discussed elsewhere in the thread what Red Hat's plans are for rolling out systemd [freedesktop.org], which will handle this).

    Indeed. "Should we be punting this for userspace tools to handle?" isn't the same question as "should we punt it to the user?".

  • by Anonymous Coward on Thursday November 18, 2010 @07:58PM (#34276536)

    They are not the same. The kernel patch groups processes by owning TTY. The bash shell change groups them by session. Source: http://lwn.net/Articles/414817/ [lwn.net]

  • by Chuck Chunder ( 21021 ) on Thursday November 18, 2010 @07:59PM (#34276542) Journal

    so those of you who've experienced broken sound in recent years

    In recent years?

    Has Linux ever had a stable sound system?
    My recollection is a neverending series of different sound related components (OSS, ALSA, ESD, aRts, Jack etc) of which the best you could say is that they worked most of the time but invariably didn't behave very well in certain cases.

    Lennart seems to cop a lot of crap over Pulseaudio but as far as I can tell it's a positive contribution in an area with a lot of historical and legacy issues.

  • Re:Whee... (Score:3, Insightful)

    by Pharmboy ( 216950 ) on Thursday November 18, 2010 @08:01PM (#34276572) Journal

    You want to see some real, over-the-top rudeness? Go to a forum designed to help Linux newbs.

    I've been tooling with Linux for 15 years now, so used to the arrogant "help" found in many forums and groups, but I've had non-Linux friends check some out and were completely amazed at the average level of rudeness in the average "help" reply. It certainly didn't make them want to jump into Linux when that is the average help. For obvious reasons, half the admin-types on Linux forums remind me of the comic book guy in the Simpsons.

    Yes, people should know more about the OS, but sometimes they just want to get something to work. Being reminded that "This isn't Windows" and "you should know $x" must feed some ego hunger. Granted, not all are like this. Only half.

  • by h4rr4r ( 612664 ) on Thursday November 18, 2010 @08:20PM (#34276764)

    It really is, and if things like flash played nice with the rest of the system it would be far less of an issue. No, grabbing /dev/audio is not the right way to play audio.

  • by brion ( 1316 ) on Thursday November 18, 2010 @08:41PM (#34276948) Homepage

    Users won't need to recompile or reconfigure anything -- they'll get the updated system installed for them by the distro packagers in upcoming versions. You only need to do anything if you want to enable this *right now by yourself*, and there are indeed a few different ways to do it.

    The differences between the change to the kernel and the shell script are basically two: one, they apparently have slightly different algorithms for choosing how to group the processes. That's not due to it being in-kernel vs out-of-kernel though -- that's just because they are slightly different. Both can be implemented in both ways, and both work with the same actual implementation mechanism -- simply one works from userspace through the interfaces and one's built-in to the kernel.

    Auto-tuning behavior that's built in will probably be the most reliable, easiest, and best-performing way to do this, rather than requiring every Linux distribution to ensure that they're running the same extra scripts and keeping the userspace stuff in sync. Do it once and leave it built-in to the kernel.

  • Re:Whee... (Score:5, Insightful)

    by gandhi_2 ( 1108023 ) on Thursday November 18, 2010 @08:44PM (#34276966) Homepage

    Ever seen a 50-year-old ER nurse? 90% of the time, they are callused to the suffering around them. It comes with repeated exposure to the environment, and although their demeanor may seem rough to others, they are extremely efficient and skilled.

    Sometimes, I think what some mistake for IT snobbishness is just a natural consequence of exposure to the lifestyle.

    I thought it would be fun to post some things in answers.yahoo.com in the IT-ish categories... after a while you realize that the REALLY good questions are drowned out by people who REALLY just need to GTFO and RTFSomething.

    I work in public ed IT, and can say with NO uncertainty that most people don't want the right answers, they want the nice answers. It's hard not be rude in some cases.... it just comes out your pores after enough exposure to the environment.

  • Re:Whee... (Score:5, Insightful)

    by bmo ( 77928 ) on Thursday November 18, 2010 @08:44PM (#34276978)

    I get rude when people expect Linux to be Windows after about the third time they complain about where the control panel is (among other things) and when they're simply trolling. It's amazing the amount of trolling going on in the help forums. Sometimes it extends to irc.

    Car analogy follows:

    "Gee, this BMW is nothing like my Ford." "Why is the battery in back again?" "They should put the battery in the engine compartment" ("but it's there for weight distribution") "I don't care about that, it's stupid"

    It's not Windows. It's not a cheap Windows. It's not anything like Windows. Stop expecting it to be Windows. Once you do that, a lot of things become _much_ easier.

    --
    BMO

  • Re:Whee... (Score:5, Insightful)

    by __aagmrb7289 ( 652113 ) on Thursday November 18, 2010 @08:45PM (#34276984) Journal
    And thus, the cycle perpetuates. Better yet, if you are going to be an ass in your reply - just don't reply. That means the user might NOT get help - and that may be a concern for them - but it's better than getting attacked - which will definitely be a concern for them.
  • Re:Whee... (Score:3, Insightful)

    by Knuckles ( 8964 ) <knuckles@@@dantian...org> on Thursday November 18, 2010 @08:50PM (#34277022)

    I've been using Linux for 15 years too and I have never seen that. I don't know where you people go to have such bad experiences. OTOH, the Windows forums I sometimes stumble into via Google are usually full of clueless guys and devoid of actual help. Granted, Windows is opaque, but still.

  • by E IS mC(Square) ( 721736 ) on Thursday November 18, 2010 @08:54PM (#34277086) Journal

    >> Just curious what others think.

    'Curious' my ass. You have a history of trolling anything and everything against Apple or pro google or pro open source. If you want to troll, there are more subtle ways.

  • by clockwise_music ( 594832 ) on Thursday November 18, 2010 @08:59PM (#34277138) Homepage Journal
    Best for you right now? Update your .bashrc file.

    Best for all the people who miss this little nugget? Include it in the kernel.
  • Re:Whee... (Score:2, Insightful)

    by h4rr4r ( 612664 ) on Thursday November 18, 2010 @09:09PM (#34277224)

    So you would rather have no help, instead of help that is not phrased to your liking?

    Grow up.

  • by willy_me ( 212994 ) on Thursday November 18, 2010 @09:20PM (#34277312)
    But I was under the impression that Android devices already utilized a different scheduler. In addition, phones have different requirements - for example, some might require a real-time kernel in order to operate on a cell network. Long story short, messing with the scheduler could have serious repercussions on an Android device. Only those who really know what they are doing should attempt it. The rest of us should simply wait - unless you don't care if your phone is reliable or not.
  • Re:Whee... (Score:3, Insightful)

    by h4rr4r ( 612664 ) on Thursday November 18, 2010 @09:31PM (#34277384)

    I prefer to be friendly to the folks I like and not worry about the rest. I tend to be pretty easy going, and have helped my fair share of folks, including mailing other slashdotters hardware. I have zero problem showing people how to do something or where they can find more information on a topic.

    Complaining about stuff you get for free just irks me, it is the ultimate rudeness.

    Ever hear the expression "beggars can't be choosers"?

  • by adisakp ( 705706 ) on Thursday November 18, 2010 @09:35PM (#34277416) Journal

    However I disagree with the conclusion that the patch should therefore be merged into the kernel. First, instead of pasting some lines to bashrc and running some commands, the user now has to recompile to kernel to benefit from the change. That's a lot less user friendly. Secondly, if one really wants to push user friendliness, one should convince distributions to update their init scripts to run those cgroup commands automatically. Since all software users use go through distros anyway it should be the distros' job to ensure user friendliness.

    Umm no. It will be in the default kernal eventually and that works out-of-the-box. The idea that user friendliness is "pasting some lines to bashrc and running some commands" and that "user friendliness" should be left up to distros rather than the main line for Linux is pretty much one of the reasons Linux has never really mattered on the desktop and why 95% of computer users prefer Windows or Macs.

  • Re:Whee... (Score:3, Insightful)

    by Pharmboy ( 216950 ) on Thursday November 18, 2010 @09:41PM (#34277454) Journal

    Ever seen a 50-year-old ER nurse?

    You are right in that many people are inadvertently (or apathetically) rude for the purpose of efficiency. "I don't have time to be nice, I'm busy helping sick people, and being nice slows me down." While it makes them efficient and effective at the technical skills (things that CEOs love) it doesn't necessarily make them the best care givers. Outside of actual life and death emergencies (and your ER example would be excempted), how care is given is as important as the care itself, particularly with the very young and the very old, who might be reluctant to seek help in the future if they are always scolded when getting that very care.

  • Re:Whee... (Score:3, Insightful)

    by adisakp ( 705706 ) on Thursday November 18, 2010 @09:42PM (#34277468) Journal

    Ever seen a 50-year-old ER nurse? 90% of the time, they are callused to the suffering around them. It comes with repeated exposure to the environment

    So the people who are good at Linux treat the noobs like shit because they calloused from all the pain they've suffered? That's hardly a ringing endorsement for Linux if using it long enough to become a proficient user makes you as shellshocked and numb as someone working in a triage unit.

  • by segedunum ( 883035 ) on Thursday November 18, 2010 @10:12PM (#34277678)
    The effect is exactly the same. This is just Lennart trying to hijack another useful development thread and trying to tell us how systemd will solve everything.
  • by horza ( 87255 ) on Thursday November 18, 2010 @11:13PM (#34278076) Homepage

    As opposed to being in the default bashrc and work out-of-the-box?

    Somehow I don't think the difference between pasting into a bashrc file or recompiling the kernel has been the deciding factor between Linux and Windows/Mac.

    Phillip.

  • by shutdown -p now ( 807394 ) on Thursday November 18, 2010 @11:16PM (#34278098) Journal

    No, grabbing /dev/audio is not the right way to play audio.

    Funny how it is on FreeBSD, and things generally just work.

    So much for Unix Way.

  • Re:Whee... (Score:3, Insightful)

    by zippthorne ( 748122 ) on Friday November 19, 2010 @12:48AM (#34278596) Journal

    You're missing the point. Rude help doesn't merely annoy techies who "get over" the rudeness. It also scares away the newbies, thus reducing potential sources of future help.

    Classy move there, BTW, telling someone to "Grow up" as if they're immature for noticing immaturity...

  • by Blakey Rat ( 99501 ) on Friday November 19, 2010 @03:01AM (#34279032)

    Because you can hack together a close approximation of a feature that's in an unreleased upcoming kernel? A feature that every other OS has had for 3+ years now?

    Yah, I'm bowled over.

  • Re:Whee... (Score:5, Insightful)

    by vegiVamp ( 518171 ) on Friday November 19, 2010 @04:17AM (#34279268) Homepage

    This.

    I'm on a few mailinglists, and while I do my best to provide clear, concise, correct and helpful answers to questions, I keep being amazed at how some people simply don't bother to do the basics first. Like, you know, even looking in the general direction of the manual.

    One of the lists I'm most active on these days is the MySQL one, given that I'm almost fulltime DBAing these days. Note that MyQSL has excellent and comprehensive online manuals for every version you care to run.

    I've seen people actually think that list is populated by MySQL employees who are paid to answer their every stupid question, and get impatient and testy if they haven't seen an answer in ten minutes.

    i've seen people spam the list with first their inane RTFM questions, followed by a great big stream of "insights" on how he solved it and the most obvious straight-from-the-manual statements.

    I've seen people who seem to think that the list is there to write their queries for them. After I got rather miffed and wrote a bit of a sharp mail at one of them about basic manners, what the list is for, how to ask questions properly and what to do before you even think of asking the list; that guy now consistently does his homework, tries to work it out for himself and if he really doesn't find it or wants another opinion, politely puts the question to the list in a clear and concise way. Of course he now gets all the help he needs, and he's even put a few quite interesting things to the list in the mean time. He has, interestingly, also taken to calling me 'Sir' whenever he asks me a question. I never asked for it, but I have to admit I kinda like it :-)

    Sometimes it's necessary to make it quite clear to people what they can and cannot expect from online help, and how to behave there. This used to be perfectly acceptable, but since Eternal September began, the flood of ignorance has gotten so vast that I can fully imagine it can sometimes be hard to remember actually helping people in the middle of all the stupidity.

  • by TheRaven64 ( 641858 ) on Friday November 19, 2010 @07:23AM (#34279998) Journal
    It's the buzzword-of-the-week init system for Linux. If you've been using Linux for a while, then you will be familiar with the typical pattern for deployment:
    1. Someone says 'X is crap / old / poorly understood'.
    2. Someone else writes a replacement for X, which claims to be backwards compatible, but isn't really unless you only use a small subset of the features of X.
    3. Distributions jump on the new X-replacement and ship it.
    4. Everything breaks for six months or so, and users complain.
    5. Someone else writes an X-replacement replacement, which is a less mature code base with many of the same problems as X and the original replacement.
    6. Go to step 3.
  • Re:Whee... (Score:3, Insightful)

    by TrekkieGod ( 627867 ) on Friday November 19, 2010 @10:39AM (#34281314) Homepage Journal

    Ever hear the expression "beggars can't be choosers"?

    You know, if you see a homeless person on the street begging for money, and you decide to give them a very generous $10, but you do so by pulling out a huge wad of bills, taking out that $10, crumpling it up, and throwing it down on the floor where the man needs to jump on the floor to get it before the wind will take it away...you're a better man if you instead decide not to give him the money.

    "Beggars can't be choosers" means that because the homeless person is in such dire straights, he will probably take the humiliation and grab the money anyway. It's not about giving you justification to be an asshole.

  • Re:Whee... (Score:1, Insightful)

    by Anonymous Coward on Friday November 19, 2010 @11:31AM (#34281864)

    The easiest / fastest way to get an answer and a timely response is to propose an answer incorrectly, then you will get experts tripping over themselves to sport their skill.

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...