1. 01 May, 2006 8 commits
  2. 28 Apr, 2006 2 commits
  3. 26 Apr, 2006 2 commits
  4. 20 Apr, 2006 2 commits
  5. 19 Apr, 2006 3 commits
    • OGAWA Hirofumi's avatar
      [PATCH] Add more prevent_tail_call() · 5a7b46b3
      OGAWA Hirofumi authored
      
      Those also break userland regs like following.
      
         00000000 <sys_chown16>:
            0:	0f b7 44 24 0c       	movzwl 0xc(%esp),%eax
            5:	83 ca ff             	or     $0xffffffff,%edx
            8:	0f b7 4c 24 08       	movzwl 0x8(%esp),%ecx
            d:	66 83 f8 ff          	cmp    $0xffffffff,%ax
           11:	0f 44 c2             	cmove  %edx,%eax
           14:	66 83 f9 ff          	cmp    $0xffffffff,%cx
           18:	0f 45 d1             	cmovne %ecx,%edx
           1b:	89 44 24 0c          	mov    %eax,0xc(%esp)
           1f:	89 54 24 08          	mov    %edx,0x8(%esp)
           23:	e9 fc ff ff ff       	jmp    24 <sys_chown16+0x24>
      
      where the tailcall at the end overwrites the incoming stack-frame.
      Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      [ I would _really_ like to have a way to tell gcc about calling
        conventions. The "prevent_tail_call()" macro is pretty ugly ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      5a7b46b3
    • Rafael J. Wysocki's avatar
      [PATCH] swsusp: prevent possible image corruption on resume · 4a3b98a4
      Rafael J. Wysocki authored
      
      The function free_pagedir() used by swsusp for freeing its internal data
      structures clears the PG_nosave and PG_nosave_free flags for each page
      being freed.
      
      However, during resume PG_nosave_free set means that the page in
      question is "unsafe" (ie.  it will be overwritten in the process of
      restoring the saved system state from the image), so it should not be
      used for the image data.
      
      Therefore free_pagedir() should not clear PG_nosave_free if it's called
      during resume (otherwise "unsafe" pages freed by it may be used for
      storing the image data and the data may get corrupted later on).
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      4a3b98a4
    • Eric W. Biederman's avatar
      [PATCH] task: Make task list manipulations RCU safe · 5e85d4ab
      Eric W. Biederman authored
      
      While we can currently walk through thread groups, process groups, and
      sessions with just the rcu_read_lock, this opens the door to walking the
      entire task list.
      
      We already have all of the other RCU guarantees so there is no cost in
      doing this, this should be enough so that proc can stop taking the
      tasklist lock during readdir.
      
      prev_task was killed because it has no users, and using it will miss new
      tasks when doing an rcu traversal.
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      5e85d4ab
  6. 14 Apr, 2006 3 commits
  7. 11 Apr, 2006 9 commits
  8. 09 Apr, 2006 1 commit
    • Jordan Hargrave's avatar
      [PATCH] x86_64: Fix drift with HPET timer enabled · b20367a6
      Jordan Hargrave authored
      
      If the HPET timer is enabled, the clock can drift by ~3 seconds a day.
      This is due to the HPET timer not being initialized with the correct
      setting (still using PIT count).
      
      If HZ changes, this drift can become even more pronounced.
      
      HPET patch initializes tick_nsec with correct tick_nsec settings for
      HPET timer.
      
      Vojtech comments:
      
        "It's not entirely correct (it assumes the HPET ticks totally
         exactly), but it's significantly better than assuming the PIT error
         there."
      Signed-off-by: default avatarAndi Kleen <ak@suse.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      b20367a6
  9. 02 Apr, 2006 3 commits
  10. 31 Mar, 2006 7 commits
    • Kalin KOZHUHAROV's avatar
      Fix comments: s/granuality/granularity/ · 8ba8e95e
      Kalin KOZHUHAROV authored
      
      I was grepping through the code and some `grep ganularity -R .` didn't
      catch what I thought. Then looking closer I saw the term "granuality"
      used in only four places (in comments) and granularity in many more
      places describing the same idea. Some other facts:
      
      dictionary.com does not know such a word
      define:granuality on google is not found (and pages for granuality are
      mostly related to patches to the kernel)
      it has not been discussed as a term on LKML, AFAICS (=Can Search)
      
      To be consistent, I think granularity should be used everywhere.
      Signed-off-by: default avatarKalin KOZHUHAROV <kalin@thinrope.net>
      Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
      8ba8e95e
    • Eric Sesterhenn's avatar
      BUG_ON() Conversion in kernel/printk.c · 8abd8e29
      Eric Sesterhenn authored
      
      this changes if() BUG(); constructs to BUG_ON() which is
      cleaner, contains unlikely() and can better optimized away.
      Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
      Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
      8abd8e29
    • Adrian Bunk's avatar
      help text: SOFTWARE_SUSPEND doesn't need ACPI · 3e6e952d
      Adrian Bunk authored
      
      The note that SOFTWARE_SUSPEND doesn't need APM is helpful, but nowadays
      the information that it doesn't need ACPI, too, is even more helpful.
      Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
      3e6e952d
    • Kirill Korotaev's avatar
      [PATCH] wrong error path in dup_fd() leading to oopses in RCU · 42862298
      Kirill Korotaev authored
      
      Wrong error path in dup_fd() - it should return NULL on error,
      not an address of already freed memory :/
      
      Triggered by OpenVZ stress test suite.
      
      What is interesting is that it was causing different oopses in RCU like
      below:
      Call Trace:
         [<c013492c>] rcu_do_batch+0x2c/0x80
         [<c0134bdd>] rcu_process_callbacks+0x3d/0x70
         [<c0126cf3>] tasklet_action+0x73/0xe0
         [<c01269aa>] __do_softirq+0x10a/0x130
         [<c01058ff>] do_softirq+0x4f/0x60
         =======================
         [<c0113817>] smp_apic_timer_interrupt+0x77/0x110
         [<c0103b54>] apic_timer_interrupt+0x1c/0x24
        Code:  Bad EIP value.
         <0>Kernel panic - not syncing: Fatal exception in interrupt
      Signed-Off-By: default avatarPavel Emelianov <xemul@sw.ru>
      Signed-Off-By: default avatarDmitry Mishin <dim@openvz.org>
      Signed-Off-By: default avatarKirill Korotaev <dev@openvz.org>
      Signed-Off-By: default avatarLinus Torvalds <torvalds@osdl.org>
      42862298
    • Eric W. Biederman's avatar
      [PATCH] pidhash: Refactor the pid hash table · 92476d7f
      Eric W. Biederman authored
      
      Simplifies the code, reduces the need for 4 pid hash tables, and makes the
      code more capable.
      
      In the discussions I had with Oleg it was felt that to a large extent the
      cleanup itself justified the work.  With struct pid being dynamically
      allocated meant we could create the hash table entry when the pid was
      allocated and free the hash table entry when the pid was freed.  Instead of
      playing with the hash lists when ever a process would attach or detach to a
      process.
      
      For myself the fact that it gave what my previous task_ref patch gave for free
      with simpler code was a big win.  The problem is that if you hold a reference
      to struct task_struct you lock in 10K of low memory.  If you do that in a user
      controllable way like /proc does, with an unprivileged but hostile user space
      application with typical resource limits of 1000 fds and 100 processes I can
      trigger the OOM killer by consuming all of low memory with task structs, on a
      machine wight 1GB of low memory.
      
      If I instead hold a reference to struct pid which holds a pointer to my
      task_struct, I don't suffer from that problem because struct pid is 2 orders
      of magnitude smaller.  In fact struct pid is small enough that most other
      kernel data structures dwarf it, so simply limiting the number of referring
      data structures is enough to prevent exhaustion of low memory.
      
      This splits the current struct pid into two structures, struct pid and struct
      pid_link, and reduces our number of hash tables from PIDTYPE_MAX to just one.
      struct pid_link is the per process linkage into the hash tables and lives in
      struct task_struct.  struct pid is given an indepedent lifetime, and holds
      pointers to each of the pid types.
      
      The independent life of struct pid simplifies attach_pid, and detach_pid,
      because we are always manipulating the list of pids and not the hash table.
      In addition in giving struct pid an indpendent life it makes the concept much
      more powerful.
      
      Kernel data structures can now embed a struct pid * instead of a pid_t and
      not suffer from pid wrap around problems or from keeping unnecessarily
      large amounts of memory allocated.
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      92476d7f
    • Eric W. Biederman's avatar
      [PATCH] task: RCU protect task->usage · 8c7904a0
      Eric W. Biederman authored
      
      A big problem with rcu protected data structures that are also reference
      counted is that you must jump through several hoops to increase the reference
      count.  I think someone finally implemented atomic_inc_not_zero(&count) to
      automate the common case.  Unfortunately this means you must special case the
      rcu access case.
      
      When data structures are only visible via rcu in a manner that is not
      determined by the reference count on the object (i.e.  tasks are visible until
      their zombies are reaped) there is a much simpler technique we can employ.
      Simply delaying the decrement of the reference count until the rcu interval is
      over.
      
      What that means is that the proc code that looks up a task and later
      wants to sleep can now do:
      
      rcu_read_lock();
      task = find_task_by_pid(some_pid);
      if (task) {
      	get_task_struct(task);
      }
      rcu_read_unlock();
      
      The effect on the rest of the kernel is that put_task_struct becomes cheaper
      and immediate, and in the case where the task has been reaped it frees the
      task immediate instead of unnecessarily waiting an until the rcu interval is
      over.
      
      Cleanup of task_struct does not happen when its reference count drops to
      zero, instead cleanup happens when release_task is called.  Tasks can only
      be looked up via rcu before release_task is called.  All rcu protected
      members of task_struct are freed by release_task.
      
      Therefore we can move call_rcu from put_task_struct into release_task.  And
      we can modify release_task to not immediately release the reference count
      but instead have it call put_task_struct from the function it gives to
      call_rcu.
      
      The end result:
      
      - get_task_struct is safe in an rcu context where we have just looked
        up the task.
      
      - put_task_struct() simplifies into its old pre rcu self.
      
      This reorganization also makes put_task_struct uncallable from modules as
      it is not exported but it does not appear to be called from any modules so
      this should not be an issue, and is trivially fixed.
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      8c7904a0
    • Andrew Morton's avatar
      [PATCH] resurrect __put_task_struct · 158d9ebd
      Andrew Morton authored
      
      This just got nuked in mainline.  Bring it back because Eric's patches use it.
      
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      158d9ebd