1. 13 1月, 2012 1 次提交
  2. 11 1月, 2012 1 次提交
    • D
      kernel.h: add BUILD_BUG() macro · 1399ff86
      David Daney 提交于
      We can place this in definitions that we expect the compiler to remove by
      dead code elimination.  If this assertion fails, we get a nice error
      message at build time.
      
      The GCC function attribute error("message") was added in version 4.3, so
      we define a new macro __linktime_error(message) to expand to this for
      GCC-4.3 and later.  This will give us an error diagnostic from the
      compiler on the line that fails.  For other compilers
      __linktime_error(message) expands to nothing, and we have to be content
      with a link time error, but at least we will still get a build error.
      
      BUILD_BUG() expands to the undefined function __build_bug_failed() and
      will fail at link time if the compiler ever emits code for it.  On GCC-4.3
      and later, attribute((error())) is used so that the failure will be noted
      at compile time instead.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Acked-by: NDavid Rientjes <rientjes@google.com>
      Cc: DM <dm.n9107@gmail.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1399ff86
  3. 05 12月, 2011 1 次提交
  4. 07 11月, 2011 1 次提交
  5. 01 11月, 2011 3 次提交
  6. 21 9月, 2011 1 次提交
    • M
      lib: add error checking to hex2bin · b7804983
      Mimi Zohar 提交于
      hex2bin converts a hexadecimal string to its binary representation.
      The original version of hex2bin did not do any error checking.  This
      patch adds error checking and returns the result.
      
      Changelog v1:
      - removed unpack_hex_byte()
      - changed return code from boolean to int
      
      Changelog:
      - use the new unpack_hex_byte()
      - add __must_check compiler option (Andy Shevchenko's suggestion)
      - change function API to return error checking result
        (based on Tetsuo Handa's initial patch)
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      b7804983
  7. 26 7月, 2011 3 次提交
  8. 23 6月, 2011 1 次提交
  9. 16 6月, 2011 1 次提交
  10. 25 5月, 2011 2 次提交
  11. 19 5月, 2011 1 次提交
    • S
      ftrace: Allow dynamically allocated function tracers · cdbe61bf
      Steven Rostedt 提交于
      Now that functions may be selected individually, it only makes sense
      that we should allow dynamically allocated trace structures to
      be traced. This will allow perf to allocate a ftrace_ops structure
      at runtime and use it to pick and choose which functions that
      structure will trace.
      
      Note, a dynamically allocated ftrace_ops will always be called
      indirectly instead of being called directly from the mcount in
      entry.S. This is because there's no safe way to prevent mcount
      from being preempted before calling the function, unless we
      modify every entry.S to do so (not likely). Thus, dynamically allocated
      functions will now be called by the ftrace_ops_list_func() that
      loops through the ops that are allocated if there are more than
      one op allocated at a time. This loop is protected with a
      preempt_disable.
      
      To determine if an ftrace_ops structure is allocated or not, a new
      util function was added to the kernel/extable.c called
      core_kernel_data(), which returns 1 if the address is between
      _sdata and _edata.
      
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      cdbe61bf
  12. 23 3月, 2011 1 次提交
    • A
      kstrto*: converting strings to integers done (hopefully) right · 33ee3b2e
      Alexey Dobriyan 提交于
      1. simple_strto*() do not contain overflow checks and crufty,
         libc way to indicate failure.
      2. strict_strto*() also do not have overflow checks but the name and
         comments pretend they do.
      3. Both families have only "long long" and "long" variants,
         but users want strtou8()
      4. Both "simple" and "strict" prefixes are wrong:
         Simple doesn't exactly say what's so simple, strict should not exist
         because conversion should be strict by default.
      
      The solution is to use "k" prefix and add convertors for more types.
      Enter
      	kstrtoull()
      	kstrtoll()
      	kstrtoul()
      	kstrtol()
      	kstrtouint()
      	kstrtoint()
      
      	kstrtou64()
      	kstrtos64()
      	kstrtou32()
      	kstrtos32()
      	kstrtou16()
      	kstrtos16()
      	kstrtou8()
      	kstrtos8()
      
      Include runtime testsuite (somewhat incomplete) as well.
      
      strict_strto*() become deprecated, stubbed to kstrto*() and
      eventually will be removed altogether.
      
      Use kstrto*() in code today!
      
      Note: on some archs _kstrtoul() and _kstrtol() are left in tree, even if
            they'll be unused at runtime. This is temporarily solution,
            because I don't want to hardcode list of archs where these
            functions aren't needed. Current solution with sizeof() and
            __alignof__ at least always works.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      33ee3b2e
  13. 01 2月, 2011 1 次提交
  14. 24 1月, 2011 2 次提交
    • R
      Remove MAYBE_BUILD_BUG_ON · 1765e3a4
      Rusty Russell 提交于
      Now BUILD_BUG_ON() can handle optimizable constants, we don't need
      MAYBE_BUILD_BUG_ON any more.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      1765e3a4
    • R
      BUILD_BUG_ON: make it handle more cases · 7ef88ad5
      Rusty Russell 提交于
      BUILD_BUG_ON used to use the optimizer to do code elimination or fail
      at link time; it was changed to first the size of a negative array (a
      nicer compile time error), then (in
      8c87df45) to a bitfield.
      
      This forced us to change some non-constant cases to MAYBE_BUILD_BUG_ON();
      as Jan points out in that commit, it didn't work as intended anyway.
      
      bitfields: needs a literal constant at parse time, and can't be put under
      	"if (__builtin_constant_p(x))" for example.
      negative array: can handle anything, but if the compiler can't tell it's
      	a constant, silently has no effect.
      link time: breaks link if the compiler can't determine the value, but the
      	linker output is not usually as informative as a compiler error.
      
      If we use the negative-array-size method *and* the link time trick,
      we get the ability to use BUILD_BUG_ON() under __builtin_constant_p()
      branches, and maximal ability for the compiler to detect errors at
      build time.
      
      We also document it thoroughly.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Jan Beulich <JBeulich@novell.com>
      Acked-by: NHollis Blanchard <hollisb@us.ibm.com>
      7ef88ad5
  15. 20 1月, 2011 1 次提交
    • T
      lockdep: Move early boot local IRQ enable/disable status to init/main.c · 2ce802f6
      Tejun Heo 提交于
      During early boot, local IRQ is disabled until IRQ subsystem is
      properly initialized.  During this time, no one should enable
      local IRQ and some operations which usually are not allowed with
      IRQ disabled, e.g. operations which might sleep or require
      communications with other processors, are allowed.
      
      lockdep tracked this with early_boot_irqs_off/on() callbacks.
      As other subsystems need this information too, move it to
      init/main.c and make it generally available.  While at it,
      toggle the boolean to early_boot_irqs_disabled instead of
      enabled so that it can be initialized with %false and %true
      indicates the exceptional condition.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NPekka Enberg <penberg@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <20110120110635.GB6036@htj.dyndns.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2ce802f6
  16. 14 1月, 2011 2 次提交
    • M
      mm: vmscan: reclaim order-0 and use compaction instead of lumpy reclaim · 3e7d3449
      Mel Gorman 提交于
      Lumpy reclaim is disruptive.  It reclaims a large number of pages and
      ignores the age of the pages it reclaims.  This can incur significant
      stalls and potentially increase the number of major faults.
      
      Compaction has reached the point where it is considered reasonably stable
      (meaning it has passed a lot of testing) and is a potential candidate for
      displacing lumpy reclaim.  This patch introduces an alternative to lumpy
      reclaim whe compaction is available called reclaim/compaction.  The basic
      operation is very simple - instead of selecting a contiguous range of
      pages to reclaim, a number of order-0 pages are reclaimed and then
      compaction is later by either kswapd (compact_zone_order()) or direct
      compaction (__alloc_pages_direct_compact()).
      
      [akpm@linux-foundation.org: fix build]
      [akpm@linux-foundation.org: use conventional task_struct naming]
      Signed-off-by: NMel Gorman <mel@csn.ul.ie>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Rik van Riel <riel@redhat.com>
      Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Andy Whitcroft <apw@shadowen.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3e7d3449
    • A
      include/linux/kernel.h: abs(): fix handling of 32-bit unsigneds on 64-bit · 71a90484
      Andrew Morton 提交于
      Michal reports:
      
      In the framebuffer subsystem the abs() macro is often used as a part of
      the calculation of a Manhattan metric, which in turn is used as a measure
      of similarity between video modes.  The arguments of abs() are sometimes
      unsigned numbers.  This worked fine until commit a49c59c0 ("Make sure the
      value in abs() does not get truncated if it is greater than 2^32:) , which
      changed the definition of abs() to prevent truncation.  As a result of
      this change, in the following piece of code:
      
      u32 a = 0, b = 1;
      u32 c = abs(a - b);
      
      'c' will end up with a value of 0xffffffff instead of the expected 0x1.
      
      A problem caused by this change and visible by the end user is that
      framebuffer drivers relying on functions from modedb.c will fail to find
      high resolution video modes similar to that explicitly requested by the
      user if an exact match cannot be found (see e.g.
      
      Fix this by special-casing `long' types within abs().
      
      This patch reduces x86_64 code size a bit - drivers/video/uvesafb.o shrunk
      by 15 bytes, presumably because it is doing abs() on 4-byte quantities,
      and expanding those to 8-byte longs adds code.
      
      testcase:
      
      #define oldabs(x) ({				\
      		long __x = (x);			\
      		(__x < 0) ? -__x : __x;		\
      	})
      
      #define newabs(x) ({						\
      		long ret;					\
      		if (sizeof(x) == sizeof(long)) {		\
      			long __x = (x);				\
      			ret = (__x < 0) ? -__x : __x;		\
      		} else {					\
      			int __x = (x);				\
      			ret = (__x < 0) ? -__x : __x;		\
      		}						\
      		ret;						\
      	})
      
      typedef unsigned int u32;
      
      main()
      {
      	u32 a = 0;
      	u32 b = 1;
      	u32 oldc = oldabs(a - b);
      	u32 newc = newabs(a - b);
      
      	printf("%u %u\n", oldc, newc);
      }
      
      akpm:/home/akpm> gcc t.c
      akpm:/home/akpm> ./a.out
      4294967295 1
      Reported-by: NMichal Januszewski <michalj@gmail.com>
      Cc: Rolf Eike Beer <eike-kernel@sf-tec.de
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      71a90484
  17. 29 11月, 2010 1 次提交
  18. 16 11月, 2010 1 次提交
  19. 12 11月, 2010 1 次提交
  20. 10 11月, 2010 1 次提交
  21. 09 11月, 2010 1 次提交
  22. 27 10月, 2010 4 次提交
  23. 21 10月, 2010 2 次提交
  24. 11 9月, 2010 1 次提交
  25. 13 8月, 2010 1 次提交
  26. 11 8月, 2010 2 次提交
  27. 10 8月, 2010 1 次提交
  28. 20 7月, 2010 1 次提交