1. 08 1月, 2011 7 次提交
    • L
      Merge branch 'rmobile-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 · d074b104
      Linus Torvalds 提交于
      * 'rmobile-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (67 commits)
        ARM: mach-shmobile: update for SMP changes.
        ARM: mach-shmobile: update for GIC changes.
        ARM: mach-shmobile: Fix up clkdev fallout for SH73A0.
        dma: shdma: don't register the global die notifier multiple times
        ARM: mach-shmobile: Rely on run-time IRQ handlers
        ARM: mach-shmobile: Run-time IRQ handler for GIC
        ARM: mach-shmobile: Run-time IRQ handler for INTCA
        ARM: mach-shmobile: Enable CONFIG_MULTI_IRQ_HANDLER
        ARM: mach-shmobile: Use shared GIC entry macros
        ARM: mach-shmobile: mackerel: Add zboot support
        ARM: mach-shmobile: mackerel: Add HDMI sound support
        ARM: mach-shmobile: mackerel: add HDMI video support
        ARM: mach-shmobile: ap4evb: fixup clk_put timing of fsib_clk
        ARM: mach-shmobile: sh73a0: fix div4 table
        ARM: mach-shmobile: ap4/mackerel: modify wrong comment out of USB
        ARM: mach-shmobile: Mackerel VGA camera support
        mmc: sh_mmcif: make DMA support by the driver unconditional
        ARM: mach-shmobile: Add eMMC support through MMCIF on AG5EVM
        ARM: mach-shmobile: Use pullups for AG5EVM KEYSC pins
        ARM: mach-shmobile: sh73a0 GPIO pullup improvement
        ...
      d074b104
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 31b6ca0a
      Linus Torvalds 提交于
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (58 commits)
        Input: wacom_w8001 - support pen or touch only devices
        Input: wacom_w8001 - use __set_bit to set keybits
        Input: bu21013_ts - fix misuse of logical operation in place of bitop
        Input: i8042 - add Acer Aspire 5100 to the Dritek list
        Input: wacom - add support for digitizer in Lenovo W700
        Input: psmouse - disable the synaptics extension on OLPC machines
        Input: psmouse - fix up Synaptics comment
        Input: synaptics - ignore bogus mt packet
        Input: synaptics - add multi-finger and semi-mt support
        Input: synaptics - report clickpad property
        input: mt: Document interface updates
        Input: fix double equality sign in uevent
        Input: introduce device properties
        hid: egalax: Add support for Wetab (726b)
        Input: include MT library as source for kerneldoc
        MAINTAINERS: Update input-mt entry
        hid: egalax: Add support for Samsung NB30 netbook
        hid: egalax: Document the new devices in Kconfig
        hid: egalax: Add support for Wetab
        hid: egalax: Convert to MT slots
        ...
      
      Fixed up trivial conflict in drivers/input/keyboard/Kconfig
      31b6ca0a
    • L
      Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6 · 56b85f32
      Linus Torvalds 提交于
      * 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (36 commits)
        serial: apbuart: Fixup apbuart_console_init()
        TTY: Add tty ioctl to figure device node of the system console.
        tty: add 'active' sysfs attribute to tty0 and console device
        drivers: serial: apbuart: Handle OF failures gracefully
        Serial: Avoid unbalanced IRQ wake disable during resume
        tty: fix typos/errors in tty_driver.h comments
        pch_uart : fix warnings for 64bit compile
        8250: fix uninitialized FIFOs
        ip2: fix compiler warning on ip2main_pci_tbl
        specialix: fix compiler warning on specialix_pci_tbl
        rocket: fix compiler warning on rocket_pci_ids
        8250: add a UPIO_DWAPB32 for 32 bit accesses
        8250: use container_of() instead of casting
        serial: omap-serial: Add support for kernel debugger
        serial: fix pch_uart kconfig & build
        drivers: char: hvc: add arm JTAG DCC console support
        RS485 documentation: add 16C950 UART description
        serial: ifx6x60: fix memory leak
        serial: ifx6x60: free IRQ on error
        Serial: EG20T: add PCH_UART driver
        ...
      
      Fixed up conflicts in drivers/serial/apbuart.c with evil merge that
      makes the code look fairly sane (unlike either side).
      56b85f32
    • L
      Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 · 3e5b08cb
      Linus Torvalds 提交于
      * 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (144 commits)
        USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
        USB: serial: ftdi_sio: add support for TIOCSERGETLSR
        USB: ehci-mxc: Setup portsc register prior to accessing OTG viewport
        USB: atmel_usba_udc: fix freeing irq in usba_udc_remove()
        usb: ehci-omap: fix tll channel enable mask
        usb: ohci-omap3: fix trivial typo
        USB: gadget: ci13xxx: don't assume that PAGE_SIZE is 4096
        USB: gadget: ci13xxx: fix complete() callback for no_interrupt rq's
        USB: gadget: update ci13xxx to work with g_ether
        USB: gadgets: ci13xxx: fix probing of compiled-in gadget drivers
        Revert "USB: musb: pm: don't rely fully on clock support"
        Revert "USB: musb: blackfin: pm: make it work"
        USB: uas: Use GFP_NOIO instead of GFP_KERNEL in I/O submission path
        USB: uas: Ensure we only bind to a UAS interface
        USB: uas: Rename sense pipe and sense urb to status pipe and status urb
        USB: uas: Use kzalloc instead of kmalloc
        USB: uas: Fix up the Sense IU
        usb: musb: core: kill unneeded #include's
        DA8xx: assign name to MUSB IRQ resource
        usb: gadget: g_ncm added
        ...
      
      Manually fix up trivial conflicts in USB Kconfig changes in:
      	arch/arm/mach-omap2/Kconfig
      	arch/sh/Kconfig
      	drivers/usb/Kconfig
      	drivers/usb/host/ehci-hcd.c
      and annoying chip clock data conflicts in:
      	arch/arm/mach-omap2/clock3xxx_data.c
      	arch/arm/mach-omap2/clock44xx_data.c
      3e5b08cb
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 · da40d036
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (147 commits)
        [SCSI] arcmsr: fix write to device check
        [SCSI] lpfc: lower stack use in lpfc_fc_frame_check
        [SCSI] eliminate an unnecessary local variable from scsi_remove_target()
        [SCSI] libiscsi: use bh locking instead of irq with session lock
        [SCSI] libiscsi: do not take host lock in queuecommand
        [SCSI] be2iscsi: fix null ptr when accessing task hdr
        [SCSI] be2iscsi: fix gfp use in alloc_pdu
        [SCSI] libiscsi: add more informative failure message during iscsi scsi eh
        [SCSI] gdth: Add missing call to gdth_ioctl_free
        [SCSI] bfa: remove unused defintions and misc cleanups
        [SCSI] bfa: remove inactive functions
        [SCSI] bfa: replace bfa_assert with WARN_ON
        [SCSI] qla2xxx: Use sg_next to fetch next sg element while walking sg list.
        [SCSI] qla2xxx: Fix to avoid recursive lock failure during BSG timeout.
        [SCSI] qla2xxx: Remove code to not reset ISP82xx on failure.
        [SCSI] qla2xxx: Display mailbox register 4 during 8012 AEN for ISP82XX parts.
        [SCSI] qla2xxx: Don't perform a BIG_HAMMER if Get-ID (0x20) mailbox command fails on CNAs.
        [SCSI] qla2xxx: Remove redundant module parameter permission bits
        [SCSI] qla2xxx: Add sysfs node for displaying board temperature.
        [SCSI] qla2xxx: Code cleanup to remove unwanted comments and code.
        ...
      da40d036
    • D
      input/tc3589x: fix compile error · aa58abc2
      Dan Carpenter 提交于
      There was a semi-colon missing and it broke the compile.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NLinus Walleij <linus.walleij@stericsson.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      aa58abc2
    • L
      Merge branch 'vfs-scale-working' of... · b4a45f5f
      Linus Torvalds 提交于
      Merge branch 'vfs-scale-working' of git://git.kernel.org/pub/scm/linux/kernel/git/npiggin/linux-npiggin
      
      * 'vfs-scale-working' of git://git.kernel.org/pub/scm/linux/kernel/git/npiggin/linux-npiggin: (57 commits)
        fs: scale mntget/mntput
        fs: rename vfsmount counter helpers
        fs: implement faster dentry memcmp
        fs: prefetch inode data in dcache lookup
        fs: improve scalability of pseudo filesystems
        fs: dcache per-inode inode alias locking
        fs: dcache per-bucket dcache hash locking
        bit_spinlock: add required includes
        kernel: add bl_list
        xfs: provide simple rcu-walk ACL implementation
        btrfs: provide simple rcu-walk ACL implementation
        ext2,3,4: provide simple rcu-walk ACL implementation
        fs: provide simple rcu-walk generic_check_acl implementation
        fs: provide rcu-walk aware permission i_ops
        fs: rcu-walk aware d_revalidate method
        fs: cache optimise dentry and inode for rcu-walk
        fs: dcache reduce branches in lookup path
        fs: dcache remove d_mounted
        fs: fs_struct use seqlock
        fs: rcu-walk for path lookup
        ...
      b4a45f5f
  2. 07 1月, 2011 33 次提交
    • N
      fs: scale mntget/mntput · b3e19d92
      Nick Piggin 提交于
      The problem that this patch aims to fix is vfsmount refcounting scalability.
      We need to take a reference on the vfsmount for every successful path lookup,
      which often go to the same mount point.
      
      The fundamental difficulty is that a "simple" reference count can never be made
      scalable, because any time a reference is dropped, we must check whether that
      was the last reference. To do that requires communication with all other CPUs
      that may have taken a reference count.
      
      We can make refcounts more scalable in a couple of ways, involving keeping
      distributed counters, and checking for the global-zero condition less
      frequently.
      
      - check the global sum once every interval (this will delay zero detection
        for some interval, so it's probably a showstopper for vfsmounts).
      
      - keep a local count and only taking the global sum when local reaches 0 (this
        is difficult for vfsmounts, because we can't hold preempt off for the life of
        a reference, so a counter would need to be per-thread or tied strongly to a
        particular CPU which requires more locking).
      
      - keep a local difference of increments and decrements, which allows us to sum
        the total difference and hence find the refcount when summing all CPUs. Then,
        keep a single integer "long" refcount for slow and long lasting references,
        and only take the global sum of local counters when the long refcount is 0.
      
      This last scheme is what I implemented here. Attached mounts and process root
      and working directory references are "long" references, and everything else is
      a short reference.
      
      This allows scalable vfsmount references during path walking over mounted
      subtrees and unattached (lazy umounted) mounts with processes still running
      in them.
      
      This results in one fewer atomic op in the fastpath: mntget is now just a
      per-CPU inc, rather than an atomic inc; and mntput just requires a spinlock
      and non-atomic decrement in the common case. However code is otherwise bigger
      and heavier, so single threaded performance is basically a wash.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      b3e19d92
    • N
      fs: rename vfsmount counter helpers · c6653a83
      Nick Piggin 提交于
      Suggested by Andreas, mnt_ prefix is clearer namespace, follows kernel
      conventions better, and is easier for tab complete. I introduced these
      names so I'll admit they were not good choices.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      c6653a83
    • N
      fs: implement faster dentry memcmp · 9d55c369
      Nick Piggin 提交于
      The standard memcmp function on a Westmere system shows up hot in
      profiles in the `git diff` workload (both parallel and single threaded),
      and it is likely due to the costs associated with trapping into
      microcode, and little opportunity to improve memory access (dentry
      name is not likely to take up more than a cacheline).
      
      So replace it with an open-coded byte comparison. This increases code
      size by 8 bytes in the critical __d_lookup_rcu function, but the
      speedup is huge, averaging 10 runs of each:
      
      git diff st   user   sys   elapsed  CPU
      before        1.15   2.57  3.82      97.1
      after         1.14   2.35  3.61      96.8
      
      git diff mt   user   sys   elapsed  CPU
      before        1.27   3.85  1.46     349
      after         1.26   3.54  1.43     333
      
      Elapsed time for single threaded git diff at 95.0% confidence:
              -0.21  +/- 0.01
              -5.45% +/- 0.24%
      
      It's -0.66% +/- 0.06% elapsed time on my Opteron, so rep cmp costs on the
      fam10h seem to be relatively smaller, but there is still a win.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      9d55c369
    • N
      fs: prefetch inode data in dcache lookup · e1bb5782
      Nick Piggin 提交于
      This makes single threaded git diff -1.25% +/- 0.05% elapsed time on my
      2s12c24t Westmere system, and -0.86% +/- 0.05% on my 2s8c Barcelona, by
      prefetching the important first cacheline of the inode in while we do the
      actual name compare and other operations on the dentry.
      
      There was no measurable slowdown in the single file stat case, or the creat
      case (where negative dentries would be common).
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      e1bb5782
    • N
      fs: improve scalability of pseudo filesystems · 4b936885
      Nick Piggin 提交于
      Regardless of how much we possibly try to scale dcache, there is likely
      always going to be some fundamental contention when adding or removing children
      under the same parent. Pseudo filesystems do not seem need to have connected
      dentries because by definition they are disconnected.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      4b936885
    • N
      fs: dcache per-inode inode alias locking · 873feea0
      Nick Piggin 提交于
      dcache_inode_lock can be replaced with per-inode locking. Use existing
      inode->i_lock for this. This is slightly non-trivial because we sometimes
      need to find the inode from the dentry, which requires d_inode to be
      stabilised (either with refcount or d_lock).
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      873feea0
    • N
      fs: dcache per-bucket dcache hash locking · ceb5bdc2
      Nick Piggin 提交于
      We can turn the dcache hash locking from a global dcache_hash_lock into
      per-bucket locking.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      ceb5bdc2
    • N
      bit_spinlock: add required includes · 626d6074
      Nick Piggin 提交于
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      626d6074
    • N
      kernel: add bl_list · 4e35e607
      Nick Piggin 提交于
      Introduce a type of hlist that can support the use of the lowest bit in the
      hlist_head. This will be subsequently used to implement per-bucket bit spinlock
      for inode and dentry hashes, and may be useful in other cases such as network
      hashes.
      Reviewed-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      4e35e607
    • N
      xfs: provide simple rcu-walk ACL implementation · 880566e1
      Nick Piggin 提交于
      This simple implementation just checks for no ACLs on the inode, and
      if so, then the rcu-walk may proceed, otherwise fail it.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      880566e1
    • N
      btrfs: provide simple rcu-walk ACL implementation · 258a5aa8
      Nick Piggin 提交于
      This simple implementation just checks for no ACLs on the inode, and
      if so, then the rcu-walk may proceed, otherwise fail it.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      258a5aa8
    • N
      ext2,3,4: provide simple rcu-walk ACL implementation · 73598611
      Nick Piggin 提交于
      This simple implementation just checks for no ACLs on the inode, and
      if so, then the rcu-walk may proceed, otherwise fail it.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      73598611
    • N
      fs: provide simple rcu-walk generic_check_acl implementation · 1e1743eb
      Nick Piggin 提交于
      This simple implementation just checks for no ACLs on the inode, and
      if so, then the rcu-walk may proceed, otherwise fail it.
      
      This could easily be extended to put acls under RCU and check them
      under seqlock, if need be. But this implementation is enough to show
      the rcu-walk aware permissions code for path lookups is working, and
      will handle cases where there are no ACLs or ACLs in just the final
      element.
      
      This patch implicity converts tmpfs to rcu-aware permission check.
      Subsequent patches onvert ext*, xfs, and, btrfs. Each of these uses
      acl/permission code in a different way, so convert them all to provide
      templates and proof of concept.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      1e1743eb
    • N
      fs: provide rcu-walk aware permission i_ops · b74c79e9
      Nick Piggin 提交于
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      b74c79e9
    • N
      fs: rcu-walk aware d_revalidate method · 34286d66
      Nick Piggin 提交于
      Require filesystems be aware of .d_revalidate being called in rcu-walk
      mode (nd->flags & LOOKUP_RCU). For now do a simple push down, returning
      -ECHILD from all implementations.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      34286d66
    • N
      fs: cache optimise dentry and inode for rcu-walk · 44a7d7a8
      Nick Piggin 提交于
      Put dentry and inode fields into top of data structure.  This allows RCU path
      traversal to perform an RCU dentry lookup in a path walk by touching only the
      first 56 bytes of the dentry.
      
      We also fit in 8 bytes of inline name in the first 64 bytes, so for short
      names, only 64 bytes needs to be touched to perform the lookup. We should
      get rid of the hash->prev pointer from the first 64 bytes, and fit 16 bytes
      of name in there, which will take care of 81% rather than 32% of the kernel
      tree.
      
      inode is also rearranged so that RCU lookup will only touch a single cacheline
      in the inode, plus one in the i_ops structure.
      
      This is important for directory component lookups in RCU path walking. In the
      kernel source, directory names average is around 6 chars, so this works.
      
      When we reach the last element of the lookup, we need to lock it and take its
      refcount which requires another cacheline access.
      
      Align dentry and inode operations structs, so members will be at predictable
      offsets and we can group common operations into head of structure.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      44a7d7a8
    • N
      fs: dcache reduce branches in lookup path · fb045adb
      Nick Piggin 提交于
      Reduce some branches and memory accesses in dcache lookup by adding dentry
      flags to indicate common d_ops are set, rather than having to check them.
      This saves a pointer memory access (dentry->d_op) in common path lookup
      situations, and saves another pointer load and branch in cases where we
      have d_op but not the particular operation.
      
      Patched with:
      
      git grep -E '[.>]([[:space:]])*d_op([[:space:]])*=' | xargs sed -e 's/\([^\t ]*\)->d_op = \(.*\);/d_set_d_op(\1, \2);/' -e 's/\([^\t ]*\)\.d_op = \(.*\);/d_set_d_op(\&\1, \2);/' -i
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      fb045adb
    • N
      fs: dcache remove d_mounted · 5f57cbcc
      Nick Piggin 提交于
      Rather than keep a d_mounted count in the dentry, set a dentry flag instead.
      The flag can be cleared by checking the hash table to see if there are any
      mounts left, which is not time critical because it is performed at detach time.
      
      The mounted state of a dentry is only used to speculatively take a look in the
      mount hash table if it is set -- before following the mount, vfsmount lock is
      taken and mount re-checked without races.
      
      This saves 4 bytes on 32-bit, nothing on 64-bit but it does provide a hole I
      might use later (and some configs have larger than 32-bit spinlocks which might
      make use of the hole).
      
      Autofs4 conversion and changelog by Ian Kent <raven@themaw.net>:
      In autofs4, when expring direct (or offset) mounts we need to ensure that we
      block user path walks into the autofs mount, which is covered by another mount.
      To do this we clear the mounted status so that follows stop before walking into
      the mount and are essentially blocked until the expire is completed. The
      automount daemon still finds the correct dentry for the umount due to the
      follow mount logic in fs/autofs4/root.c:autofs4_follow_link(), which is set as
      an inode operation for direct and offset mounts only and is called following
      the lookup that stopped at the covered mount.
      
      At the end of the expire the covering mount probably has gone away so the
      mounted status need not be restored. But we need to check this and only restore
      the mounted status if the expire failed.
      
      XXX: autofs may not work right if we have other mounts go over the top of it?
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      5f57cbcc
    • N
      fs: fs_struct use seqlock · c28cc364
      Nick Piggin 提交于
      Use a seqlock in the fs_struct to enable us to take an atomic copy of the
      complete cwd and root paths. Use this in the RCU lookup path to avoid a
      thread-shared spinlock in RCU lookup operations.
      
      Multi-threaded apps may now perform path lookups with scalability matching
      multi-process apps. Operations such as stat(2) become very scalable for
      multi-threaded workload.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      c28cc364
    • N
      fs: rcu-walk for path lookup · 31e6b01f
      Nick Piggin 提交于
      Perform common cases of path lookups without any stores or locking in the
      ancestor dentry elements. This is called rcu-walk, as opposed to the current
      algorithm which is a refcount based walk, or ref-walk.
      
      This results in far fewer atomic operations on every path element,
      significantly improving path lookup performance. It also avoids cacheline
      bouncing on common dentries, significantly improving scalability.
      
      The overall design is like this:
      * LOOKUP_RCU is set in nd->flags, which distinguishes rcu-walk from ref-walk.
      * Take the RCU lock for the entire path walk, starting with the acquiring
        of the starting path (eg. root/cwd/fd-path). So now dentry refcounts are
        not required for dentry persistence.
      * synchronize_rcu is called when unregistering a filesystem, so we can
        access d_ops and i_ops during rcu-walk.
      * Similarly take the vfsmount lock for the entire path walk. So now mnt
        refcounts are not required for persistence. Also we are free to perform mount
        lookups, and to assume dentry mount points and mount roots are stable up and
        down the path.
      * Have a per-dentry seqlock to protect the dentry name, parent, and inode,
        so we can load this tuple atomically, and also check whether any of its
        members have changed.
      * Dentry lookups (based on parent, candidate string tuple) recheck the parent
        sequence after the child is found in case anything changed in the parent
        during the path walk.
      * inode is also RCU protected so we can load d_inode and use the inode for
        limited things.
      * i_mode, i_uid, i_gid can be tested for exec permissions during path walk.
      * i_op can be loaded.
      
      When we reach the destination dentry, we lock it, recheck lookup sequence,
      and increment its refcount and mountpoint refcount. RCU and vfsmount locks
      are dropped. This is termed "dropping rcu-walk". If the dentry refcount does
      not match, we can not drop rcu-walk gracefully at the current point in the
      lokup, so instead return -ECHILD (for want of a better errno). This signals the
      path walking code to re-do the entire lookup with a ref-walk.
      
      Aside from the final dentry, there are other situations that may be encounted
      where we cannot continue rcu-walk. In that case, we drop rcu-walk (ie. take
      a reference on the last good dentry) and continue with a ref-walk. Again, if
      we can drop rcu-walk gracefully, we return -ECHILD and do the whole lookup
      using ref-walk. But it is very important that we can continue with ref-walk
      for most cases, particularly to avoid the overhead of double lookups, and to
      gain the scalability advantages on common path elements (like cwd and root).
      
      The cases where rcu-walk cannot continue are:
      * NULL dentry (ie. any uncached path element)
      * parent with d_inode->i_op->permission or ACLs
      * dentries with d_revalidate
      * Following links
      
      In future patches, permission checks and d_revalidate become rcu-walk aware. It
      may be possible eventually to make following links rcu-walk aware.
      
      Uncached path elements will always require dropping to ref-walk mode, at the
      very least because i_mutex needs to be grabbed, and objects allocated.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      31e6b01f
    • N
      kernel: optimise seqlock · 3c22cd57
      Nick Piggin 提交于
      Add branch annotations for seqlock read fastpath, and introduce
      __read_seqcount_begin and __read_seqcount_end functions, that can avoid the
      smp_rmb() if used carefully. These will be used by store-free path walking
      algorithm performance is critical and seqlocks are in use.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      3c22cd57
    • N
      fs: avoid inode RCU freeing for pseudo fs · ff0c7d15
      Nick Piggin 提交于
      Pseudo filesystems that don't put inode on RCU list or reachable by
      rcu-walk dentries do not need to RCU free their inodes.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      ff0c7d15
    • N
      fs: icache RCU free inodes · fa0d7e3d
      Nick Piggin 提交于
      RCU free the struct inode. This will allow:
      
      - Subsequent store-free path walking patch. The inode must be consulted for
        permissions when walking, so an RCU inode reference is a must.
      - sb_inode_list_lock to be moved inside i_lock because sb list walkers who want
        to take i_lock no longer need to take sb_inode_list_lock to walk the list in
        the first place. This will simplify and optimize locking.
      - Could remove some nested trylock loops in dcache code
      - Could potentially simplify things a bit in VM land. Do not need to take the
        page lock to follow page->mapping.
      
      The downsides of this is the performance cost of using RCU. In a simple
      creat/unlink microbenchmark, performance drops by about 10% due to inability to
      reuse cache-hot slab objects. As iterations increase and RCU freeing starts
      kicking over, this increases to about 20%.
      
      In cases where inode lifetimes are longer (ie. many inodes may be allocated
      during the average life span of a single inode), a lot of this cache reuse is
      not applicable, so the regression caused by this patch is smaller.
      
      The cache-hot regression could largely be avoided by using SLAB_DESTROY_BY_RCU,
      however this adds some complexity to list walking and store-free path walking,
      so I prefer to implement this at a later date, if it is shown to be a win in
      real situations. I haven't found a regression in any non-micro benchmark so I
      doubt it will be a problem.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      fa0d7e3d
    • N
      fs: consolidate dentry kill sequence · 77812a1e
      Nick Piggin 提交于
      The tricky locking for disposing of a dentry is duplicated 3 times in the
      dcache (dput, pruning a dentry from the LRU, and pruning its ancestors).
      Consolidate them all into a single function dentry_kill.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      77812a1e
    • N
      ec33679d
    • N
      fs: reduce dcache_inode_lock width in lru scanning · be182bff
      Nick Piggin 提交于
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      be182bff
    • N
      fs: dcache reduce prune_one_dentry locking · 89e60548
      Nick Piggin 提交于
      prune_one_dentry can avoid quite a bit of locking in the common case where
      ancestors have an elevated refcount. Alternatively, we could have gone the
      other way and made fewer trylocks in the case where d_count goes to zero, but
      is probably less common.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      89e60548
    • N
      fs: dcache reduce d_parent locking · a734eb45
      Nick Piggin 提交于
      Use RCU to simplify locking in dget_parent.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      a734eb45
    • N
      fs: dcache rationalise dget variants · dc0474be
      Nick Piggin 提交于
      dget_locked was a shortcut to avoid the lazy lru manipulation when we already
      held dcache_lock (lru manipulation was relatively cheap at that point).
      However, how that the lru lock is an innermost one, we never hold it at any
      caller, so the lock cost can now be avoided. We already have well working lazy
      dcache LRU, so it should be fine to defer LRU manipulations to scan time.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      dc0474be
    • N
      fs: dcache reduce dcache_inode_lock · 357f8e65
      Nick Piggin 提交于
      dcache_inode_lock can be avoided in d_delete() and d_materialise_unique()
      in cases where it is not required.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      357f8e65
    • N
      fs: dcache reduce locking in d_alloc · 89ad485f
      Nick Piggin 提交于
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      89ad485f
    • N
      fs: dcache reduce dput locking · 61f3dee4
      Nick Piggin 提交于
      It is possible to run dput without taking data structure locks up-front. In
      many cases where we don't kill the dentry anyway, these locks are not required.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      61f3dee4
    • N
      fs: dcache avoid starvation in dcache multi-step operations · 58db63d0
      Nick Piggin 提交于
      Long lived dcache "multi-step" operations which retry on rename seq can
      be starved with a lot of rename activity. If they fail after the 1st pass,
      take the rename_lock for writing to avoid further starvation.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      58db63d0