1. 11 8月, 2010 38 次提交
  2. 10 8月, 2010 2 次提交
    • 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