1. 17 12月, 2009 8 次提交
  2. 16 12月, 2009 7 次提交
    • A
      tree-wide: convert open calls to remove spaces to skip_spaces() lib function · e7d2860b
      André Goddard Rosa 提交于
      Makes use of skip_spaces() defined in lib/string.c for removing leading
      spaces from strings all over the tree.
      
      It decreases lib.a code size by 47 bytes and reuses the function tree-wide:
         text    data     bss     dec     hex filename
        64688     584     592   65864   10148 (TOTALS-BEFORE)
        64641     584     592   65817   10119 (TOTALS-AFTER)
      
      Also, while at it, if we see (*str && isspace(*str)), we can be sure to
      remove the first condition (*str) as the second one (isspace(*str)) also
      evaluates to 0 whenever *str == 0, making it redundant. In other words,
      "a char equals zero is never a space".
      
      Julia Lawall tried the semantic patch (http://coccinelle.lip6.fr) below,
      and found occurrences of this pattern on 3 more files:
          drivers/leds/led-class.c
          drivers/leds/ledtrig-timer.c
          drivers/video/output.c
      
      @@
      expression str;
      @@
      
      ( // ignore skip_spaces cases
      while (*str &&  isspace(*str)) { \(str++;\|++str;\) }
      |
      - *str &&
      isspace(*str)
      )
      Signed-off-by: NAndré Goddard Rosa <andre.goddard@gmail.com>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Neil Brown <neilb@suse.de>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
      Cc: David Howells <dhowells@redhat.com>
      Cc: <linux-ext4@vger.kernel.org>
      Cc: Samuel Ortiz <samuel@sortiz.org>
      Cc: Patrick McHardy <kaber@trash.net>
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e7d2860b
    • B
      vt: introduce and use vt_kmsg_redirect() function · 5ada918b
      Bernhard Walle 提交于
      The kernel offers with TIOCL_GETKMSGREDIRECT ioctl() the possibility to
      redirect the kernel messages to a specific console.
      
      However, since it's not possible to switch to the kernel message console
      after a panic(), it would be nice if the kernel would print the panic
      message on the current console.
      
      This patch series adds a new interface to access the global kmsg_redirect
      variable by a function to be able to use it in code where
      CONFIG_VT_CONSOLE is not set (kernel/panic.c).
      
      This patch:
      
      Instead of using and exporting a global value kmsg_redirect, introduce a
      function vt_kmsg_redirect() that both can set and return the console where
      messages are printed.
      
      Change all users of kmsg_redirect (the VT code itself and kernel/power.c)
      to the new interface.
      
      The main advantage is that vt_kmsg_redirect() can also be used when
      CONFIG_VT_CONSOLE is not set.
      Signed-off-by: NBernhard Walle <bernhard@bwalle.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5ada918b
    • H
      kernel/sys.c: fix "warning: do-while statement is not a compound statement" noise · dfc6a736
      H Hartley Sweeten 提交于
      do_each_thread/while_each_thread wrap a block of code that is in this format:
      
      	for (...)
      		do
      			...
      		while
      
      If curly braces do not surround the inner loop the following warning is
      generated by sparse:
      
      	warning: do-while statement is not a compound statement
      
      Fix the warning by adding the braces.
      Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dfc6a736
    • X
      generic-ipi: cleanup for generic_smp_call_function_interrupt() · c0f68c2f
      Xiao Guangrong 提交于
      Use smp_processor_id() instead of get_cpu() and put_cpu() in
      generic_smp_call_function_interrupt(), It's no need to disable preempt,
      because we must call generic_smp_call_function_interrupt() with interrupts
      disabled.
      Signed-off-by: NXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c0f68c2f
    • A
      'sysctl_max_map_count' should be non-negative · 70da2340
      Amerigo Wang 提交于
      Jan Engelhardt reported we have this problem:
      
      setting max_map_count to a value large enough results in programs dying at
      first try.  This is on 2.6.31.6:
      
      15:59 borg:/proc/sys/vm # echo $[1<<31-1] >max_map_count
      15:59 borg:/proc/sys/vm # cat max_map_count
      1073741824
      15:59 borg:/proc/sys/vm # echo $[1<<31] >max_map_count
      15:59 borg:/proc/sys/vm # cat max_map_count
      Killed
      
      This is because we have a chance to make 'max_map_count' negative.  but
      it's meaningless.  Make it only accept non-negative values.
      Reported-by: NJan Engelhardt <jengelh@medozas.de>
      Signed-off-by: NWANG Cong <amwang@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: James Morris <jmorris@namei.org>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      70da2340
    • L
      hugetlb: derive huge pages nodes allowed from task mempolicy · 06808b08
      Lee Schermerhorn 提交于
      This patch derives a "nodes_allowed" node mask from the numa mempolicy of
      the task modifying the number of persistent huge pages to control the
      allocation, freeing and adjusting of surplus huge pages when the pool page
      count is modified via the new sysctl or sysfs attribute
      "nr_hugepages_mempolicy".  The nodes_allowed mask is derived as follows:
      
      * For "default" [NULL] task mempolicy, a NULL nodemask_t pointer
        is produced.  This will cause the hugetlb subsystem to use
        node_online_map as the "nodes_allowed".  This preserves the
        behavior before this patch.
      * For "preferred" mempolicy, including explicit local allocation,
        a nodemask with the single preferred node will be produced.
        "local" policy will NOT track any internode migrations of the
        task adjusting nr_hugepages.
      * For "bind" and "interleave" policy, the mempolicy's nodemask
        will be used.
      * Other than to inform the construction of the nodes_allowed node
        mask, the actual mempolicy mode is ignored.  That is, all modes
        behave like interleave over the resulting nodes_allowed mask
        with no "fallback".
      
      See the updated documentation [next patch] for more information
      about the implications of this patch.
      
      Examples:
      
      Starting with:
      
      	Node 0 HugePages_Total:     0
      	Node 1 HugePages_Total:     0
      	Node 2 HugePages_Total:     0
      	Node 3 HugePages_Total:     0
      
      Default behavior [with or without this patch] balances persistent
      hugepage allocation across nodes [with sufficient contiguous memory]:
      
      	sysctl vm.nr_hugepages[_mempolicy]=32
      
      yields:
      
      	Node 0 HugePages_Total:     8
      	Node 1 HugePages_Total:     8
      	Node 2 HugePages_Total:     8
      	Node 3 HugePages_Total:     8
      
      Of course, we only have nr_hugepages_mempolicy with the patch,
      but with default mempolicy, nr_hugepages_mempolicy behaves the
      same as nr_hugepages.
      
      Applying mempolicy--e.g., with numactl [using '-m' a.k.a.
      '--membind' because it allows multiple nodes to be specified
      and it's easy to type]--we can allocate huge pages on
      individual nodes or sets of nodes.  So, starting from the
      condition above, with 8 huge pages per node, add 8 more to
      node 2 using:
      
      	numactl -m 2 sysctl vm.nr_hugepages_mempolicy=40
      
      This yields:
      
      	Node 0 HugePages_Total:     8
      	Node 1 HugePages_Total:     8
      	Node 2 HugePages_Total:    16
      	Node 3 HugePages_Total:     8
      
      The incremental 8 huge pages were restricted to node 2 by the
      specified mempolicy.
      
      Similarly, we can use mempolicy to free persistent huge pages
      from specified nodes:
      
      	numactl -m 0,1 sysctl vm.nr_hugepages_mempolicy=32
      
      yields:
      
      	Node 0 HugePages_Total:     4
      	Node 1 HugePages_Total:     4
      	Node 2 HugePages_Total:    16
      	Node 3 HugePages_Total:     8
      
      The 8 huge pages freed were balanced over nodes 0 and 1.
      
      [rientjes@google.com: accomodate reworked NODEMASK_ALLOC]
      Signed-off-by: NDavid Rientjes <rientjes@google.com>
      Signed-off-by: NLee Schermerhorn <lee.schermerhorn@hp.com>
      Acked-by: NMel Gorman <mel@csn.ul.ie>
      Reviewed-by: NAndi Kleen <andi@firstfloor.org>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      Cc: Nishanth Aravamudan <nacc@us.ibm.com>
      Cc: Adam Litke <agl@us.ibm.com>
      Cc: Andy Whitcroft <apw@canonical.com>
      Cc: Eric Whitney <eric.whitney@hp.com>
      Cc: Christoph Lameter <cl@linux-foundation.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      06808b08
    • A
      bsdacct: fix uid/gid misreporting · 4b731d50
      Alexey Dobriyan 提交于
      commit d8e180dc "bsdacct: switch
      credentials for writing to the accounting file" introduced credential
      switching during final acct data collecting.  However, uid/gid pair
      continued to be collected from current which became credentials of who
      created acct file, not who exits.
      
      Addresses http://bugzilla.kernel.org/show_bug.cgi?id=14676Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Reported-by: NJuho K. Juopperi <jkj@kapsi.fi>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NMichal Schmidt <mschmidt@redhat.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4b731d50
  3. 15 12月, 2009 23 次提交
  4. 13 12月, 2009 2 次提交
    • J
      sched: Use pr_fmt() and pr_<level>() · 663997d4
      Joe Perches 提交于
      - Convert printk(KERN_<level> to pr_<level> (not KERN_DEBUG)
       - Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
       - Coalesce long format strings
       - Add missing \n to "ERROR: !SD_LOAD_BALANCE domain has parent"
      Signed-off-by: NJoe Perches <joe@perches.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1260655047.2637.7.camel@Joe-Laptop.home>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      663997d4
    • R
      sched: Make wakeup side and atomic variants of completion API irq safe · 7539a3b3
      Rafael J. Wysocki 提交于
      Alan Stern noticed that all the wakeup side (and atomic) variants of the
      completion APIs should be irq safe, but the newly introduced
      completion_done() and try_wait_for_completion() aren't. The use of the
      irq unsafe variants in IRQ contexts can cause crashes/hangs.
      
      Fix the problem by making them use spin_lock_irqsave() and
      spin_lock_irqrestore().
      Reported-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: pm list <linux-pm@lists.linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: David Chinner <david@fromorbit.com>
      Cc: Lachlan McIlroy <lachlan@sgi.com>
      LKML-Reference: <200912130007.30541.rjw@sisk.pl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      7539a3b3