1. 11 8月, 2010 34 次提交
  2. 10 8月, 2010 6 次提交
    • E
      flex_array: add helpers to get and put to make pointers easy to use · ea98eed9
      Eric Paris 提交于
      Getting and putting arrays of pointers with flex arrays is a PITA.  You
      have to remember to pass &ptr to the _put and you have to do weird and
      wacky casting to get the ptr back from the _get.  Add two functions
      flex_array_get_ptr() and flex_array_put_ptr() to handle all of the magic.
      
      [akpm@linux-foundation.org: simplification suggested by Joe]
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Dave Hansen <dave@linux.vnet.ibm.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ea98eed9
    • A
      iommu: inline iommu_num_pages · e269b085
      Anton Blanchard 提交于
      A profile of a network benchmark showed iommu_num_pages rather high up:
      
           0.52%  iommu_num_pages
      
      Looking at the profile, an integer divide is taking almost all of the time:
      
            %
               :      c000000000376ea4 <.iommu_num_pages>:
          1.93 :      c000000000376ea4:       fb e1 ff f8     std     r31,-8(r1)
          0.00 :      c000000000376ea8:       f8 21 ff c1     stdu    r1,-64(r1)
          0.00 :      c000000000376eac:       7c 3f 0b 78     mr      r31,r1
          3.86 :      c000000000376eb0:       38 84 ff ff     addi    r4,r4,-1
          0.00 :      c000000000376eb4:       38 05 ff ff     addi    r0,r5,-1
          0.00 :      c000000000376eb8:       7c 84 2a 14     add     r4,r4,r5
         46.95 :      c000000000376ebc:       7c 00 18 38     and     r0,r0,r3
         45.66 :      c000000000376ec0:       7c 84 02 14     add     r4,r4,r0
          0.00 :      c000000000376ec4:       7c 64 2b 92     divdu   r3,r4,r5
          0.00 :      c000000000376ec8:       38 3f 00 40     addi    r1,r31,64
          0.00 :      c000000000376ecc:       eb e1 ff f8     ld      r31,-8(r1)
          1.61 :      c000000000376ed0:       4e 80 00 20     blr
      
      Since every caller of iommu_num_pages passes in a constant power of two
      we can inline this such that the divide is replaced by a shift. The
      entire function is only a few instructions once optimised, so it is
      a good candidate for inlining overall.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Cc: Akinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e269b085
    • J
      kernel.h: remove unused NIPQUAD and NIPQUAD_FMT · cf4ca487
      Joe Perches 提交于
      There are no more uses of NIPQUAD or NIPQUAD_FMT.  Remove the definitions.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cf4ca487
    • R
      include/linux/compiler-gcc.h: use __same_type() in __must_be_array() · ea6b101d
      Rusty Russell 提交于
      We should use the __same_type() helper in __must_be_array().
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Reported-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ea6b101d
    • M
      asm-generic/io.h: add big endian versions of io{read,write}{16,32} · 7387be33
      Mike Frysinger 提交于
      The asm-generic/iomap.h provides these functions already, but the
      non-generic fallback defines do not.
      Signed-off-by: NMike Frysinger <vapier@gentoo.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7387be33
    • A
      cpuidle: extend cpuidle and menu governor to handle dynamic states · 71abbbf8
      Ai Li 提交于
      On some SoC chips, HW resources may be in use during any particular idle
      period.  As a consequence, the cpuidle states that the SoC is safe to
      enter can change from idle period to idle period.  In addition, the
      latency and threshold of each cpuidle state can vary, depending on the
      operating condition when the CPU becomes idle, e.g.  the current cpu
      frequency, the current state of the HW blocks, etc.
      
      cpuidle core and the menu governor, in the current form, are geared
      towards cpuidle states that are static, i.e.  the availabiltiy of the
      states, their latencies, their thresholds are non-changing during run
      time.  cpuidle does not provide any hook that cpuidle drivers can use to
      adjust those values on the fly for the current idle period before the menu
      governor selects the target cpuidle state.
      
      This patch extends cpuidle core and the menu governor to handle states
      that are dynamic.  There are three additions in the patch and the patch
      maintains backwards-compatibility with existing cpuidle drivers.
      
      1) add prepare() to struct cpuidle_device.  A cpuidle driver can hook
         into the callback and cpuidle will call prepare() before calling the
         governor's select function.  The callback gives the cpuidle driver a
         chance to update the dynamic information of the cpuidle states for the
         current idle period, e.g.  state availability, latencies, thresholds,
         power values, etc.
      
      2) add CPUIDLE_FLAG_IGNORE as one of the state flags.  In the prepare()
         function, a cpuidle driver can set/clear the flag to indicate to the
         menu governor whether a cpuidle state should be ignored, i.e.  not
         available, during the current idle period.
      
      3) add power_specified bit to struct cpuidle_device.  The menu governor
         currently assumes that the cpuidle states are arranged in the order of
         increasing latency, threshold, and power savings.  This is true or can
         be made true for static states.  Once the state parameters are dynamic,
         the latencies, thresholds, and power savings for the cpuidle states can
         increase or decrease by different amounts from idle period to idle
         period.  So the assumption of increasing latency, threshold, and power
         savings from Cn to C(n+1) can no longer be guaranteed.
      
      It can be straightforward to calculate the power consumption of each
      available state and to specify it in power_usage for the idle period.
      Using the power_usage fields, the menu governor then selects the state
      that has the lowest power consumption and that still satisfies all other
      critieria.  The power_specified bit defaults to 0.  For existing cpuidle
      drivers, cpuidle detects that power_specified is 0 and fills in a dummy
      set of power_usage values.
      Signed-off-by: NAi Li <aili@codeaurora.org>
      Cc: Len Brown <len.brown@intel.com>
      Acked-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Venkatesh Pallipadi <venki@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      71abbbf8