Skip to content
Permalink
Qu-Wenruo/btrf…

Commits on Nov 29, 2016

  1. btrfs: qgroup: Cleanup btrfs_qgroup_prepare_account_extents function

    Quite a lot of qgroup corruption happens due to wrong timing of calling
    btrfs_qgroup_prepare_account_extents().
    
    Since the safest timing is calling it just before
    btrfs_qgroup_account_extents(), there is no need to separate these 2
    function.
    
    Merging them will make code cleaner and less bug prone.
    
    Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
    Qu Wenruo authored and fengguang committed Nov 29, 2016
  2. btrfs: qgroup: Add quick exit for non-fs extents

    For btrfs_qgroup_account_extent(), modify make it exit quicker for
    non-fs extents.
    
    This will also reduce the noise in trace_btrfs_qgroup_account_extent
    event.
    
    Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
    Qu Wenruo authored and fengguang committed Nov 29, 2016
  3. btrfs: qgroup: Fix qgroup corruption caused by inode_cache mount option

    [BUG]
    The easist way to reproduce the bug is:
    ------
     # mkfs.btrfs -f $dev -n 16K
     # mount $dev $mnt -o inode_cache
     # btrfs quota enable $mnt
     # btrfs quota rescan -w $mnt
     # btrfs qgroup show $mnt
    qgroupid         rfer         excl
    --------         ----         ----
    0/5          32.00KiB     32.00KiB
                 ^^ Twice the correct value
    ------
    
    And fstests/btrfs qgroup test group can easily detect them with
    inode_cache mount option.
    Although some of them are false alerts since old test cases are using
    fixed golden output.
    While new test cases will use "btrfs check" to detect qgroup mismatch.
    
    [CAUSE]
    Inode_cache mount option will make commit_fs_roots() to call
    btrfs_save_ino_cache() to update fs/subvol trees, and generate new
    delayed refs.
    
    However we call btrfs_qgroup_prepare_account_extents() too early, before
    commit_fs_roots().
    This makes the "old_roots" for newly generated extents are always NULL.
    For freeing extent case, this makes both new_roots and old_roots to be
    empty, while correct old_roots should not be empty.
    This causing qgroup numbers not decreased correctly.
    
    [FIX]
    Modify the timing of calling btrfs_qgroup_prepare_account_extents() to
    just before btrfs_qgroup_account_extents(), and add needed delayed_refs
    handler.
    So qgroup can handle inode_map mount options correctly.
    
    Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
    Qu Wenruo authored and fengguang committed Nov 29, 2016

Commits on Nov 28, 2016

  1. Add linux-next specific files for 20161128

    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    sfrothwell committed Nov 28, 2016
  2. Merge branch 'akpm/master'

    sfrothwell committed Nov 28, 2016
  3. dax: clear dirty entry tags on cache flush

    Currently we never clear dirty tags in DAX mappings and thus address
    ranges to flush accumulate.  Now that we have locking of radix tree
    entries, we have all the locking necessary to reliably clear the radix
    tree dirty tag when flushing caches for corresponding address range.
    Similarly to page_mkclean() we also have to write-protect pages to get a
    page fault when the page is next written to so that we can mark the entry
    dirty again.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-21-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  4. dax: protect PTE modification on WP fault by radix tree entry lock

    Currently PTE gets updated in wp_pfn_shared() after dax_pfn_mkwrite() has
    released corresponding radix tree entry lock.  When we want to
    writeprotect PTE on cache flush, we need PTE modification to happen under
    radix tree entry lock to ensure consistent updates of PTE and radix tree
    (standard faults use page lock to ensure this consistency).  So move
    update of PTE bit into dax_pfn_mkwrite().
    
    Link: http://lkml.kernel.org/r/1479460644-25076-20-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  5. dax: make cache flushing protected by entry lock

    Currently, flushing of caches for DAX mappings was ignoring entry lock.
    So far this was ok (modulo a bug that a difference in entry lock could
    cause cache flushing to be mistakenly skipped) but in the following
    patches we will write-protect PTEs on cache flushing and clear dirty tags.
    For that we will need more exclusion.  So do cache flushing under an
    entry lock.  This allows us to remove one lock-unlock pair of
    mapping->tree_lock as a bonus.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-19-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  6. mm: export follow_pte()

    DAX will need to implement its own version of page_check_address().  To
    avoid duplicating page table walking code, export follow_pte() which does
    what we need.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-18-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  7. mm: change return values of finish_mkwrite_fault()

    Currently finish_mkwrite_fault() returns 0 when PTE got changed before
    we acquired PTE lock and VM_FAULT_WRITE when we succeeded in modifying
    the PTE. This is somewhat confusing since 0 generally means success, it
    is also inconsistent with finish_fault() which returns 0 on success.
    Change finish_mkwrite_fault() to return 0 on success and VM_FAULT_NOPAGE
    when PTE changed. Practically, there should be no behavioral difference
    since we bail out from the fault the same way regardless whether we
    return 0, VM_FAULT_NOPAGE, or VM_FAULT_WRITE. Also note that
    VM_FAULT_WRITE has no effect for shared mappings since the only two
    places that check it - KSM and GUP - care about private mappings only.
    Generally the meaning of VM_FAULT_WRITE for shared mappings is not well
    defined and we should probably clean that up.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-17-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  8. mm: provide helper for finishing mkwrite faults

    Provide a helper function for finishing write faults due to PTE being
    read-only.  The helper will be used by DAX to avoid the need of
    complicating generic MM code with DAX locking specifics.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-16-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  9. mm: move part of wp_page_reuse() into the single call site

    wp_page_reuse() handles write shared faults which is needed only in
    wp_page_shared().  Move the handling only into that location to make
    wp_page_reuse() simpler and avoid a strange situation when we sometimes
    pass in locked page, sometimes unlocked etc.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-15-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  10. mm: use vmf->page during WP faults

    So far we set vmf->page during WP faults only when we needed to pass it to
    the ->page_mkwrite handler.  Set it in all the cases now and use that
    instead of passing page pointer explicitly around.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-14-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  11. mm: pass vm_fault structure into do_page_mkwrite()

    We will need more information in the ->page_mkwrite() helper for DAX to be
    able to fully finish faults there.  Pass vm_fault structure to
    do_page_mkwrite() and use it there so that information propagates properly
    from upper layers.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-13-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  12. mm: factor out common parts of write fault handling

    Currently we duplicate handling of shared write faults in wp_page_reuse()
    and do_shared_fault().  Factor them out into a common function.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-12-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  13. mm: move handling of COW faults into DAX code

    Move final handling of COW faults from generic code into DAX fault
    handler.  That way generic code doesn't have to be aware of peculiarities
    of DAX locking so remove that knowledge and make locking functions private
    to fs/dax.c.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-11-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  14. mm: factor out functionality to finish page faults

    Introduce finish_fault() as a helper function for finishing page faults.
    It is rather thin wrapper around alloc_set_pte() but since we'd want to
    call this from DAX code or filesystems, it is still useful to avoid some
    boilerplate code.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-10-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  15. mm: allow full handling of COW faults in ->fault handlers

    Patch series "dax: Clear dirty bits after flushing caches", v5.
    
    Patchset to clear dirty bits from radix tree of DAX inodes when caches for
    corresponding pfns have been flushed.  In principle, these patches enable
    handlers to easily update PTEs and do other work necessary to finish the
    fault without duplicating the functionality present in the generic code.
    I'd like to thank Kirill and Ross for reviews of the series!
    
    This patch (of 20):
    
    To allow full handling of COW faults add memcg field to struct vm_fault
    and a return value of ->fault() handler meaning that COW fault is fully
    handled and memcg charge must not be canceled.  This will allow us to
    remove knowledge about special DAX locking from the generic fault code.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-9-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  16. mm: add orig_pte field into vm_fault

    Add orig_pte field to vm_fault structure to allow ->page_mkwrite handlers
    to fully handle the fault.  This also allows us to save some passing of
    extra arguments around.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-8-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  17. mm: use passed vm_fault structure for in wp_pfn_shared()

    Instead of creating another vm_fault structure, use the one passed to
    wp_pfn_shared() for passing arguments into pfn_mkwrite handler.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-7-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  18. mm: trim __do_fault() arguments

    Use vm_fault structure to pass cow_page, page, and entry in and out of the
    function.  That reduces number of __do_fault() arguments from 4 to 1.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-6-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  19. mm: use passed vm_fault structure in __do_fault()

    Instead of creating another vm_fault structure, use the one passed to
    __do_fault() for passing arguments into fault handler.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-5-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  20. mm: use pgoff in struct vm_fault instead of passing it separately

    struct vm_fault has already pgoff entry.  Use it instead of passing pgoff
    as a separate argument and then assigning it later.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-4-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  21. mm: use vmf->address instead of of vmf->virtual_address

    Every single user of vmf->virtual_address typed that entry to unsigned
    long before doing anything with it so the type of virtual_address does not
    really provide us any additional safety.  Just use masked vmf->address
    which already has the appropriate type.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-3-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  22. mm: join struct fault_env and vm_fault

    Currently we have two different structures for passing fault information
    around - struct vm_fault and struct fault_env.  DAX will need more
    information in struct vm_fault to handle its faults so the content of that
    structure would become event closer to fault_env.  Furthermore it would
    need to generate struct fault_env to be able to call some of the generic
    functions.  So at this point I don't think there's much use in keeping
    these two structures separate.  Just embed into struct vm_fault all that
    is needed to use it for both purposes.
    
    Link: http://lkml.kernel.org/r/1479460644-25076-2-git-send-email-jack@suse.cz
    Signed-off-by: Jan Kara <jack@suse.cz>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    jankara authored and sfrothwell committed Nov 28, 2016
  23. mm-unexport-__get_user_pages_unlocked-checkpatch-fixes

    ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 0123456789ab ("commit description")'
    torvalds#16:
    flag.  However, this flag was originally silently dropped by 1e98779
    
    WARNING: line over 80 characters
    torvalds#89: FILE: mm/nommu.c:179:
    +static long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
    
    WARNING: line over 80 characters
    torvalds#90: FILE: mm/nommu.c:180:
    +				      unsigned long start, unsigned long nr_pages,
    
    WARNING: line over 80 characters
    torvalds#91: FILE: mm/nommu.c:181:
    +			              struct page **pages, unsigned int gup_flags)
    
    ERROR: code indent should use tabs where possible
    torvalds#91: FILE: mm/nommu.c:181:
    +^I^I^I              struct page **pages, unsigned int gup_flags)$
    
    total: 2 errors, 3 warnings, 116 lines checked
    
    NOTE: For some of the reported defects, checkpatch may be able to
          mechanically convert to the typical style using --fix or --fix-inplace.
    
    NOTE: Whitespace errors detected.
          You may wish to use scripts/cleanpatch or scripts/cleanfile
    
    ./patches/mm-unexport-__get_user_pages_unlocked.patch has style problems, please review.
    
    NOTE: If any of the errors are false positives, please report
          them to the maintainer, see CHECKPATCH in MAINTAINERS.
    
    Please run checkpatch prior to sending patches
    
    Cc: Lorenzo Stoakes <lstoakes@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    akpm00 authored and sfrothwell committed Nov 28, 2016
  24. mm: unexport __get_user_pages_unlocked()

    Unexport the low-level __get_user_pages_unlocked() function and replaces
    invocations with calls to more appropriate higher-level functions.
    
    In hva_to_pfn_slow() we are able to replace __get_user_pages_unlocked()
    with get_user_pages_unlocked() since we can now pass gup_flags.
    
    In async_pf_execute() and process_vm_rw_single_vec() we need to pass
    different tsk, mm arguments so get_user_pages_remote() is the sane
    replacement in these cases (having added manual acquisition and release of
    mmap_sem.)
    
    Additionally get_user_pages_remote() reintroduces use of the FOLL_TOUCH
    flag.  However, this flag was originally silently dropped by 1e98779
    ("mm/gup: Introduce get_user_pages_remote()"), so this appears to have
    been unintentional and reintroducing it is therefore not an issue.
    
    Link: http://lkml.kernel.org/r/20161027095141.2569-3-lstoakes@gmail.com
    Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Radim Krcmar <rkrcmar@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    lorenzo-stoakes authored and sfrothwell committed Nov 28, 2016
  25. vfio iommu type1: merge fix for get_user_pages_remote API change

    Link: http://lkml.kernel.org/r/20161122210511.024ec341@canb.auug.org.au
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Cc: Lorenzo Stoakes <lstoakes@gmail.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    sfrothwell committed Nov 28, 2016
  26. mm: add locked parameter to get_user_pages_remote()

    Patch series "mm: unexport __get_user_pages_unlocked()".
    
    This patch series continues the cleanup of get_user_pages*() functions taking
    advantage of the fact we can now pass gup_flags as we please.
    
    It firstly adds an additional 'locked' parameter to get_user_pages_remote() to
    allow for its callers to utilise VM_FAULT_RETRY functionality. This is necessary
    as the invocation of __get_user_pages_unlocked() in process_vm_rw_single_vec()
    makes use of this and no other existing higher level function would allow it to
    do so.
    
    Secondly existing callers of __get_user_pages_unlocked() are replaced with the
    appropriate higher-level replacement - get_user_pages_unlocked() if the current
    task and memory descriptor are referenced, or get_user_pages_remote() if other
    task/memory descriptors are referenced (having acquiring mmap_sem.)
    
    This patch (of 2):
    
    Add a int *locked parameter to get_user_pages_remote() to allow
    VM_FAULT_RETRY faulting behaviour similar to get_user_pages_[un]locked().
    
    Taking into account the previous adjustments to get_user_pages*()
    functions allowing for the passing of gup_flags, we are now in a position
    where __get_user_pages_unlocked() need only be exported for his ability to
    allow VM_FAULT_RETRY behaviour, this adjustment allows us to subsequently
    unexport __get_user_pages_unlocked() as well as allowing for future
    flexibility in the use of get_user_pages_remote().
    
    Link: http://lkml.kernel.org/r/20161027095141.2569-2-lstoakes@gmail.com
    Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Radim Krcmar <rkrcmar@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    lorenzo-stoakes authored and sfrothwell committed Nov 28, 2016
  27. ipc/sem: avoid idr tree lookup for interrupted semop

    We can avoid the idr tree lookup (albeit possibly avoiding
    idr_find_fast()) when being awoken in EINTR, as the semid will not change
    in this context while blocked.  Use the sma pointer directly and take the
    sem_lock, then re-check for RMID races.  We continue to re-check the
    queue.status with the lock held such that we can detect situations where
    we where are dealing with a spurious wakeup but another task that holds
    the sem_lock updated the queue.status while we were spinning for it.  Once
    we take the lock it obviously won't change again.
    
    Being the only caller, get rid of sem_obtain_lock() altogether.
    
    Link: http://lkml.kernel.org/r/1478708774-28826-3-git-send-email-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Davidlohr Bueso authored and sfrothwell committed Nov 28, 2016
  28. ipc-sem-simplify-wait-wake-loop-checkpatch-fixes

    WARNING: line over 80 characters
    torvalds#69: FILE: ipc/sem.c:1997:
    +		 * fastpath: the semop has completed, either successfully or not, from
    
    WARNING: line over 80 characters
    #70: FILE: ipc/sem.c:1998:
    +		 * the syscall pov, is quite irrelevant to us at this point; we're done.
    
    WARNING: line over 80 characters
    torvalds#73: FILE: ipc/sem.c:2001:
    +		 * spuriously.  The queue.status is checked again in the slowpath (aka
    
    WARNING: line over 80 characters
    torvalds#74: FILE: ipc/sem.c:2002:
    +		 * after taking sem_lock), such that we can detect scenarios where we
    
    WARNING: line over 80 characters
    torvalds#75: FILE: ipc/sem.c:2003:
    +		 * were awakened externally, during the window between wake_q_add() and
    
    WARNING: line over 80 characters
    torvalds#84: FILE: ipc/sem.c:2009:
    +			 * User space could assume that semop() is a memory barrier:
    
    WARNING: line over 80 characters
    torvalds#85: FILE: ipc/sem.c:2010:
    +			 * Without the mb(), the cpu could speculatively read in user
    
    WARNING: line over 80 characters
    torvalds#86: FILE: ipc/sem.c:2011:
    +			 * space stale data that was overwritten by the previous owner
    
    total: 0 errors, 8 warnings, 127 lines checked
    
    NOTE: For some of the reported defects, checkpatch may be able to
          mechanically convert to the typical style using --fix or --fix-inplace.
    
    ./patches/ipc-sem-simplify-wait-wake-loop.patch has style problems, please review.
    
    NOTE: If any of the errors are false positives, please report
          them to the maintainer, see CHECKPATCH in MAINTAINERS.
    
    Please run checkpatch prior to sending patches
    
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    akpm00 authored and sfrothwell committed Nov 28, 2016
  29. ipc/sem: simplify wait-wake loop

    Instead of using the reverse goto, we can simplify the flow and make it
    more language natural by just doing do-while instead.  One would hope this
    is the standard way (or obviously just with a while bucle) that we do
    wait/wakeup handling in the kernel.  The exact same logic is kept, just
    more indented.
    
    Link: http://lkml.kernel.org/r/1478708774-28826-2-git-send-email-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Davidlohr Bueso authored and sfrothwell committed Nov 28, 2016
  30. ipc/sem: use proper list api for pending_list wakeups

    ... saves some LoC and looks cleaner than re-implementing the
    calls.
    
    Link: http://lkml.kernel.org/r/1474225896-10066-6-git-send-email-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Acked-by: Manfred Spraul <manfred@colorfullife.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Davidlohr Bueso authored and sfrothwell committed Nov 28, 2016
  31. ipc/sem: explicitly inline check_restart

    The compiler already does this, but make it explicit.  This helper is
    really small and also used in update_queue's main loop, which is O(N^2)
    scanning.  Inline and avoid the function overhead.
    
    Link: http://lkml.kernel.org/r/1474225896-10066-5-git-send-email-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Davidlohr Bueso authored and sfrothwell committed Nov 28, 2016
  32. ipc-sem-optimize-perform_atomic_semop-checkpatch-fixes

    WARNING: Missing a blank line after declarations
    torvalds#132: FILE: ipc/sem.c:747:
    +			int undo = un->semadj[sop->sem_num] - sem_op;
    +			un->semadj[sop->sem_num] = undo;
    
    ERROR: spaces required around that '?' (ctx:VxW)
    torvalds#142: FILE: ipc/sem.c:757:
    +	return sop->sem_flg & IPC_NOWAIT? -EAGAIN : 1;
     	                                ^
    
    total: 1 errors, 1 warnings, 171 lines checked
    
    NOTE: For some of the reported defects, checkpatch may be able to
          mechanically convert to the typical style using --fix or --fix-inplace.
    
    ./patches/ipc-sem-optimize-perform_atomic_semop.patch has style problems, please review.
    
    NOTE: If any of the errors are false positives, please report
          them to the maintainer, see CHECKPATCH in MAINTAINERS.
    
    Please run checkpatch prior to sending patches
    
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    akpm00 authored and sfrothwell committed Nov 28, 2016
Older
You can’t perform that action at this time.