1. 22 Jan, 2014 40 commits
    • Heiko Carstens's avatar
    • Heiko Carstens's avatar
      s390/uapi: fix struct statfs64 definition · 4e078146
      Heiko Carstens authored
      With b8668fd0 "s390/uapi: change struct statfs[64] member types
      to unsigned values" the size of a couple of struct statfs64 member got
      incorrectly changed from 64 to 32 bit for 32 bit builds.
      
      Fix this by changing the type of couple of struct statfs64 members from
      unsigned long to unsigned long long.
      The definition of struct compat_statfs64 was correct however.
      
      Cc: stable@vger.kernel.org # v3.10+
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      4e078146
    • Heiko Carstens's avatar
      s390/uaccess: remove dead extern declarations, make functions static · 0ff2fe52
      Heiko Carstens authored
      Remove some dead uaccess extern declarations and also make some functions
      static, since they are only used locally.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      0ff2fe52
    • Heiko Carstens's avatar
      s390/uaccess: test if current->mm is set before walking page tables · b03b4679
      Heiko Carstens authored
      If get_fs() == USER_DS we better test if current->mm is not zero before
      walking page tables.
      The page table walk code would try to lock mm->page_table_lock, however
      if mm is zero this might crash.
      
      Now it is arguably incorrect trying to access userspace if current->mm
      is zero, however we have seen that and s390 would be the only architecture
      which would crash in such a case.
      So we better make the page table walk code a bit more robust and report
      always a fault instead.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      b03b4679
    • Heiko Carstens's avatar
      s390/zfcpdump: make zfcpdump depend on 64BIT · 05e9181b
      Heiko Carstens authored
      Get rid of this link error:
      
      arch/s390/built-in.o: In function `smp_prepare_cpus':
      (.init.text+0x301e): undefined reference to `dump_save_area_create'
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      05e9181b
    • Heiko Carstens's avatar
      s390/32bit: fix cmpxchg64 · 38ea1f35
      Heiko Carstens authored
      Fix broken inline assembly contraints for cmpxchg64 on 32bit.
      
      Fixes this crash:
      
      specification exception: 0006 [#1] SMP
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.13.0 #4
      task: 005a16c8 ti: 00592000 task.ti: 00592000
      Krnl PSW : 070ce000 8029abd6 (lockref_get+0x3e/0x9c)
      ...
      Krnl Code: 8029abcc: a71a0001           ahi     %r1,1
                 8029abd0: 1852               lr      %r5,%r2
                #8029abd2: bb40f064           cds     %r4,%r0,100(%r15)
                >8029abd6: 1943               cr      %r4,%r3
                 8029abd8: 1815               lr      %r1,%r5
      Call Trace:
      ([<0000000078e01870>] 0x78e01870)
       [<000000000021105a>] sysfs_mount+0xd2/0x1c8
       [<00000000001b551e>] mount_fs+0x3a/0x134
       [<00000000001ce768>] vfs_kern_mount+0x44/0x11c
       [<00000000001ce864>] kern_mount_data+0x24/0x3c
       [<00000000005cc4b8>] sysfs_init+0x74/0xd4
       [<00000000005cb5b4>] mnt_init+0xe0/0x1fc
       [<00000000005cb16a>] vfs_caches_init+0xb6/0x14c
       [<00000000005be794>] start_kernel+0x318/0x33c
       [<000000000010001c>] _stext+0x1c/0x80
      Reported-by: default avatarMike Frysinger <vapier@gentoo.org>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      38ea1f35
    • Sebastian Ott's avatar
      s390/xpram: don't modify module parameters · 7e2e2b96
      Sebastian Ott authored
      During parsing of the sizes array the pointer to the particular
      string is lost. Keep it by using an extra pointer to store the end
      position of the parsed string. Keeping these parameters accessible
      can be helpful for debugging purposes and for userspace reading
      the parameters at runtime via sysfs. Also this will ensure that the
      memory is freed at module unload time.
      Reported-by: default avatarMichael Veigel <veigel@de.ibm.com>
      Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      7e2e2b96
    • Heiko Carstens's avatar
      s390/zcrypt: remove zcrypt kmsg documentation again · 4dd841a0
      Heiko Carstens authored
      This part of the ep11 patch should not have been merged.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      4dd841a0
    • Hendrik Brueckner's avatar
      s390/hvc_iucv: Automatically assign free HVC terminal devices · 4f592219
      Hendrik Brueckner authored
      Add the generic "lnxhvc" terminal ID to automatically assign a HVC terminal when
      connecting to the HVC IUCV terminal device driver.  The terminal device driver
      tries to find a free (not connected) HVC terminal to satisfy the incoming
      connection request.
      
      With this improvement, you do not longer need to guess which HVC terminal is
      free, that is, not connected.  Also you can still connect to a particular HVC
      terminal by using its associated terminal ID.
      Signed-off-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      4f592219
    • Hendrik Brueckner's avatar
      s390/hvc_iucv: Display connection details through device attributes · f1206bad
      Hendrik Brueckner authored
      Add device attributes to display details about the connection status
      of HVC IUCV terminals.
      Signed-off-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      f1206bad
    • Hendrik Brueckner's avatar
      s390/hvc_iucv: fix sparse warning · 2ee13c6e
      Hendrik Brueckner authored
      drivers/tty/hvc/hvc_iucv.c:131:25: warning: symbol 'hvc_iucv_get_private' was not
      declared. Should it be static?
      Signed-off-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      2ee13c6e
    • Hendrik Brueckner's avatar
      s390/vmur: Link parent CCW device during UR device creation · 964c150e
      Hendrik Brueckner authored
      When creating the virtual unit record (UR) device, specify the parent
      CCW device.
      Signed-off-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      964c150e
    • Linus Torvalds's avatar
      Merge branch 'akpm' (incoming from Andrew) · df32e43a
      Linus Torvalds authored
      Merge first patch-bomb from Andrew Morton:
      
       - a couple of misc things
      
       - inotify/fsnotify work from Jan
      
       - ocfs2 updates (partial)
      
       - about half of MM
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (117 commits)
        mm/migrate: remove unused function, fail_migrate_page()
        mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages
        mm/migrate: correct failure handling if !hugepage_migration_support()
        mm/migrate: add comment about permanent failure path
        mm, page_alloc: warn for non-blockable __GFP_NOFAIL allocation failure
        mm: compaction: reset scanner positions immediately when they meet
        mm: compaction: do not mark unmovable pageblocks as skipped in async compaction
        mm: compaction: detect when scanners meet in isolate_freepages
        mm: compaction: reset cached scanner pfn's before reading them
        mm: compaction: encapsulate defer reset logic
        mm: compaction: trace compaction begin and end
        memcg, oom: lock mem_cgroup_print_oom_info
        sched: add tracepoints related to NUMA task migration
        mm: numa: do not automatically migrate KSM pages
        mm: numa: trace tasks that fail migration due to rate limiting
        mm: numa: limit scope of lock for NUMA migrate rate limiting
        mm: numa: make NUMA-migrate related functions static
        lib/show_mem.c: show num_poisoned_pages when oom
        mm/hwpoison: add '#' to hwpoison_inject
        mm/memblock: use WARN_ONCE when MAX_NUMNODES passed as input parameter
        ...
      df32e43a
    • Linus Torvalds's avatar
      Merge branch 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata · fbd918a2
      Linus Torvalds authored
      Pull libata updates from Tejun Heo:
       "Support for some new embedded controllers.
      
        A couple late (<= a week) fixes have stable cc'd and one patch ("SATA:
        MV: Add support for the optional PHYs") got committed yesterday
        because otherwise the resulting kernel would fail boot on an embedded
        board due to interdependent changes in its platform tree.
      
        Other than that, nothing too noteworthy"
      
      * 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
        SATA: MV: Add support for the optional PHYs
        sata-highbank: Remove unnecessary ahci_platform.h include
        libata: disable LPM for some WD SATA-I devices
        ARM: mvebu: update the SATA compatible string for Armada 370/XP
        ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs
        ata: sata_mv: introduce compatible string "marvell, armada-370-sata"
        ata: pata_samsung_cf: Remove unused macros
        ata: pata_samsung_cf: Use devm_ioremap_resource()
        ata: pata_samsung_cf: Merge pata_samsung_cf.h into pata_samsung_cf.c
        ata: pata_samsung_cf: Move plat/regs-ata.h to drivers/ata
        drivers: ata: Mark the function as static in libahci.c
        drivers: ata: Mark the function ahci_init_interrupts() as static in ahci.c
        ahci: imx: fix the error handling in imx_ahci_probe()
        ahci: imx: ahci_imx_softreset() can be static
        ahci: imx: Add i.MX53 support
        ahci: imx: Pull out the clock enable/disable calls
        libata, dt: Document sata_rcar bindings
        sata_rcar: Add R-Car Gen2 SATA PHY support
        ahci: mcp89: enter AHCI mode under Apple BIOS emulation
        ata: libata-eh: Remove unnecessary snprintf arithmetic
      fbd918a2
    • Linus Torvalds's avatar
      Merge branch 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · f075e0f6
      Linus Torvalds authored
      Pull cgroup updates from Tejun Heo:
       "The bulk of changes are cleanups and preparations for the upcoming
        kernfs conversion.
      
         - cgroup_event mechanism which is and will be used only by memcg is
           moved to memcg.
      
         - pidlist handling is updated so that it can be served by seq_file.
      
           Also, the list is not sorted if sane_behavior.  cgroup
           documentation explicitly states that the file is not sorted but it
           has been for quite some time.
      
         - All cgroup file handling now happens on top of seq_file.  This is
           to prepare for kernfs conversion.  In addition, all operations are
           restructured so that they map 1-1 to kernfs operations.
      
         - Other cleanups and low-pri fixes"
      
      * 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (40 commits)
        cgroup: trivial style updates
        cgroup: remove stray references to css_id
        doc: cgroups: Fix typo in doc/cgroups
        cgroup: fix fail path in cgroup_load_subsys()
        cgroup: fix missing unlock on error in cgroup_load_subsys()
        cgroup: remove for_each_root_subsys()
        cgroup: implement for_each_css()
        cgroup: factor out cgroup_subsys_state creation into create_css()
        cgroup: combine css handling loops in cgroup_create()
        cgroup: reorder operations in cgroup_create()
        cgroup: make for_each_subsys() useable under cgroup_root_mutex
        cgroup: css iterations and css_from_dir() are safe under cgroup_mutex
        cgroup: unify pidlist and other file handling
        cgroup: replace cftype->read_seq_string() with cftype->seq_show()
        cgroup: attach cgroup_open_file to all cgroup files
        cgroup: generalize cgroup_pidlist_open_file
        cgroup: unify read path so that seq_file is always used
        cgroup: unify cgroup_write_X64() and cgroup_write_string()
        cgroup: remove cftype->read(), ->read_map() and ->write()
        hugetlb_cgroup: convert away from cftype->read()
        ...
      f075e0f6
    • Linus Torvalds's avatar
      Merge branch 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu · 5cb7398c
      Linus Torvalds authored
      Pull percpu changes from Tejun Heo:
       "Two trivial changes - addition of WARN_ONCE() in lib/percpu-refcount.c
        and use of VMALLOC_TOTAL instead of END - START in percpu.c"
      
      * 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
        percpu: use VMALLOC_TOTAL instead of VMALLOC_END - VMALLOC_START
        percpu-refcount: Add a WARN() for ref going negative
      5cb7398c
    • Linus Torvalds's avatar
      Merge branch 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq · 4a2829b9
      Linus Torvalds authored
      Pull workqueue update from Tejun Heo:
       "Just one patch to add destroy_work_on_stack() annotations to help
        debugobj debugging"
      
      * 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
        workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
      4a2829b9
    • Linus Torvalds's avatar
      Merge tag 'dlm-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm · ff0bc6cc
      Linus Torvalds authored
      Pull dlm update from David Teigland:
       "A single change to speed up recovery times when using SCTP
        connections"
      
      * tag 'dlm-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
        dlm: set zero linger time on sctp socket
      ff0bc6cc
    • Linus Torvalds's avatar
      Merge tag 'gfs2-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw · 2182c815
      Linus Torvalds authored
      Pull GFS2 updates from Steven Whitehouse:
       "The main topics this time are allocation, in the form of Bob's
        improvements when searching resource groups and several updates to
        quotas which should increase scalability.  The quota changes follow on
        from those in the last merge window, and there will likely be further
        work to come in this area in due course.
      
        There are also a few patches which help to improve efficiency of
        adding entries into directories, and clean up some of that code.
      
        One on-disk change is included this time, which is to write some
        additional information which should be useful to fsck and also
        potentially for debugging.
      
        Other than that, its just a few small random bug fixes and clean ups"
      
      * tag 'gfs2-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw: (24 commits)
        GFS2: revert "GFS2: d_splice_alias() can't return error"
        GFS2: Small cleanup
        GFS2: Don't use ENOBUFS when ENOMEM is the correct error code
        GFS2: Fix kbuild test robot reported warning
        GFS2: Move quota bitmap operations under their own lock
        GFS2: Clean up quota slot allocation
        GFS2: Only run logd and quota when mounted read/write
        GFS2: Use RCU/hlist_bl based hash for quotas
        GFS2: No need to invalidate pages for a dio read
        GFS2: Add initialization for address space in super block
        GFS2: Add hints to directory leaf blocks
        GFS2: For exhash conversion, only one block is needed
        GFS2: Increase i_writecount during gfs2_setattr_chown
        GFS2: Remember directory insert point
        GFS2: Consolidate transaction blocks calculation for dir add
        GFS2: Add directory addition info structure
        GFS2: Use only a single address space for rgrps
        GFS2: Use range based functions for rgrp sync/invalidation
        GFS2: Remove test which is always true
        GFS2: Remove gfs2_quota_change_host structure
        ...
      2182c815
    • Joonsoo Kim's avatar
      mm/migrate: remove unused function, fail_migrate_page() · 78d5506e
      Joonsoo Kim authored
      fail_migrate_page() isn't used anywhere, so remove it.
      Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Reviewed-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Reviewed-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Rafael Aquini <aquini@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      78d5506e
    • Joonsoo Kim's avatar
      mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages · 59c82b70
      Joonsoo Kim authored
      Some part of putback_lru_pages() and putback_movable_pages() is
      duplicated, so it could confuse us what we should use.  We can remove
      putback_lru_pages() since it is not really needed now.  This makes us
      undestand and maintain the code more easily.
      
      And comment on putback_movable_pages() is stale now, so fix it.
      Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Reviewed-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Rafael Aquini <aquini@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      59c82b70
    • Joonsoo Kim's avatar
      mm/migrate: correct failure handling if !hugepage_migration_support() · 32665f2b
      Joonsoo Kim authored
      We should remove the page from the list if we fail with ENOSYS, since
      migrate_pages() consider error cases except -ENOMEM and -EAGAIN as
      permanent failure and it assumes that the page would be removed from the
      list.  Without this patch, we could overcount number of failure.
      
      In addition, we should put back the new hugepage if
      !hugepage_migration_support().  If not, we would leak hugepage memory.
      Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Reviewed-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Reviewed-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Rafael Aquini <aquini@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      32665f2b
    • Naoya Horiguchi's avatar
      mm/migrate: add comment about permanent failure path · 354a3363
      Naoya Horiguchi authored
      Let's add a comment about where the failed page goes to, which makes
      code more readable.
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Reviewed-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Acked-by: default avatarRafael Aquini <aquini@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      354a3363
    • David Rientjes's avatar
      mm, page_alloc: warn for non-blockable __GFP_NOFAIL allocation failure · aed0a0e3
      David Rientjes authored
      __GFP_NOFAIL may return NULL when coupled with GFP_NOWAIT or GFP_ATOMIC.
      
      Luckily, nothing currently does such craziness.  So instead of causing
      such allocations to loop (potentially forever), we maintain the current
      behavior and also warn about the new users of the deprecated flag.
      Suggested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Michal Hocko <mhocko@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      aed0a0e3
    • Vlastimil Babka's avatar
      mm: compaction: reset scanner positions immediately when they meet · 55b7c4c9
      Vlastimil Babka authored
      Compaction used to start its migrate and free page scaners at the zone's
      lowest and highest pfn, respectively.  Later, caching was introduced to
      remember the scanners' progress across compaction attempts so that
      pageblocks are not re-scanned uselessly.  Additionally, pageblocks where
      isolation failed are marked to be quickly skipped when encountered again
      in future compactions.
      
      Currently, both the reset of cached pfn's and clearing of the pageblock
      skip information for a zone is done in __reset_isolation_suitable().
      This function gets called when:
      
       - compaction is restarting after being deferred
       - compact_blockskip_flush flag is set in compact_finished() when the scanners
         meet (and not again cleared when direct compaction succeeds in allocation)
         and kswapd acts upon this flag before going to sleep
      
      This behavior is suboptimal for several reasons:
      
       - when direct sync compaction is called after async compaction fails (in the
         allocation slowpath), it will effectively do nothing, unless kswapd
         happens to process the compact_blockskip_flush flag meanwhile. This is racy
         and goes against the purpose of sync compaction to more thoroughly retry
         the compaction of a zone where async compaction has failed.
         The restart-after-deferring path cannot help here as deferring happens only
         after the sync compaction fails. It is also done only for the preferred
         zone, while the compaction might be done for a fallback zone.
      
       - the mechanism of marking pageblock to be skipped has little value since the
         cached pfn's are reset only together with the pageblock skip flags. This
         effectively limits pageblock skip usage to parallel compactions.
      
      This patch changes compact_finished() so that cached pfn's are reset
      immediately when the scanners meet.  Clearing pageblock skip flags is
      unchanged, as well as the other situations where cached pfn's are reset.
      This allows the sync-after-async compaction to retry pageblocks not
      marked as skipped, such as blocks !MIGRATE_MOVABLE blocks that async
      compactions now skips without marking them.
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Rik van Riel <riel@redhat.com>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      55b7c4c9
    • Vlastimil Babka's avatar
      mm: compaction: do not mark unmovable pageblocks as skipped in async compaction · 50b5b094
      Vlastimil Babka authored
      Compaction temporarily marks pageblocks where it fails to isolate pages
      as to-be-skipped in further compactions, in order to improve efficiency.
      One of the reasons to fail isolating pages is that isolation is not
      attempted in pageblocks that are not of MIGRATE_MOVABLE (or CMA) type.
      
      The problem is that blocks skipped due to not being MIGRATE_MOVABLE in
      async compaction become skipped due to the temporary mark also in future
      sync compaction.  Moreover, this may follow quite soon during
      __alloc_page_slowpath, without much time for kswapd to clear the
      pageblock skip marks.  This goes against the idea that sync compaction
      should try to scan these blocks more thoroughly than the async
      compaction.
      
      The fix is to ensure in async compaction that these !MIGRATE_MOVABLE
      blocks are not marked to be skipped.  Note this should not affect
      performance or locking impact of further async compactions, as skipping
      a block due to being !MIGRATE_MOVABLE is done soon after skipping a
      block marked to be skipped, both without locking.
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Rik van Riel <riel@redhat.com>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      50b5b094
    • Vlastimil Babka's avatar
      mm: compaction: detect when scanners meet in isolate_freepages · 7ed695e0
      Vlastimil Babka authored
      Compaction of a zone is finished when the migrate scanner (which begins
      at the zone's lowest pfn) meets the free page scanner (which begins at
      the zone's highest pfn).  This is detected in compact_zone() and in the
      case of direct compaction, the compact_blockskip_flush flag is set so
      that kswapd later resets the cached scanner pfn's, and a new compaction
      may again start at the zone's borders.
      
      The meeting of the scanners can happen during either scanner's activity.
      However, it may currently fail to be detected when it occurs in the free
      page scanner, due to two problems.  First, isolate_freepages() keeps
      free_pfn at the highest block where it isolated pages from, for the
      purposes of not missing the pages that are returned back to allocator
      when migration fails.  Second, failing to isolate enough free pages due
      to scanners meeting results in -ENOMEM being returned by
      migrate_pages(), which makes compact_zone() bail out immediately without
      calling compact_finished() that would detect scanners meeting.
      
      This failure to detect scanners meeting might result in repeated
      attempts at compaction of a zone that keep starting from the cached
      pfn's close to the meeting point, and quickly failing through the
      -ENOMEM path, without the cached pfns being reset, over and over.  This
      has been observed (through additional tracepoints) in the third phase of
      the mmtests stress-highalloc benchmark, where the allocator runs on an
      otherwise idle system.  The problem was observed in the DMA32 zone,
      which was used as a fallback to the preferred Normal zone, but on the
      4GB system it was actually the largest zone.  The problem is even
      amplified for such fallback zone - the deferred compaction logic, which
      could (after being fixed by a previous patch) reset the cached scanner
      pfn's, is only applied to the preferred zone and not for the fallbacks.
      
      The problem in the third phase of the benchmark was further amplified by
      commit 81c0a2bb ("mm: page_alloc: fair zone allocator policy") which
      resulted in a non-deterministic regression of the allocation success
      rate from ~85% to ~65%.  This occurs in about half of benchmark runs,
      making bisection problematic.  It is unlikely that the commit itself is
      buggy, but it should put more pressure on the DMA32 zone during phases 1
      and 2, which may leave it more fragmented in phase 3 and expose the bugs
      that this patch fixes.
      
      The fix is to make scanners meeting in isolate_freepage() stay that way,
      and to check in compact_zone() for scanners meeting when migrate_pages()
      returns -ENOMEM.  The result is that compact_finished() also detects
      scanners meeting and sets the compact_blockskip_flush flag to make
      kswapd reset the scanner pfn's.
      
      The results in stress-highalloc benchmark show that the "regression" by
      commit 81c0a2bb in phase 3 no longer occurs, and phase 1 and 2
      allocation success rates are also significantly improved.
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7ed695e0
    • Vlastimil Babka's avatar
      mm: compaction: reset cached scanner pfn's before reading them · d3132e4b
      Vlastimil Babka authored
      Compaction caches pfn's for its migrate and free scanners to avoid
      scanning the whole zone each time.  In compact_zone(), the cached values
      are read to set up initial values for the scanners.  There are several
      situations when these cached pfn's are reset to the first and last pfn
      of the zone, respectively.  One of these situations is when a compaction
      has been deferred for a zone and is now being restarted during a direct
      compaction, which is also done in compact_zone().
      
      However, compact_zone() currently reads the cached pfn's *before*
      resetting them.  This means the reset doesn't affect the compaction that
      performs it, and with good chance also subsequent compactions, as
      update_pageblock_skip() is likely to be called and update the cached
      pfn's to those being processed.  Another chance for a successful reset
      is when a direct compaction detects that migration and free scanners
      meet (which has its own problems addressed by another patch) and sets
      update_pageblock_skip flag which kswapd uses to do the reset because it
      goes to sleep.
      
      This is clearly a bug that results in non-deterministic behavior, so
      this patch moves the cached pfn reset to be performed *before* the
      values are read.
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Acked-by: default avatarRik van Riel <riel@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d3132e4b
    • Vlastimil Babka's avatar
      mm: compaction: encapsulate defer reset logic · de6c60a6
      Vlastimil Babka authored
      Currently there are several functions to manipulate the deferred
      compaction state variables.  The remaining case where the variables are
      touched directly is when a successful allocation occurs in direct
      compaction, or is expected to be successful in the future by kswapd.
      Here, the lowest order that is expected to fail is updated, and in the
      case of successful allocation, the deferred status and counter is reset
      completely.
      
      Create a new function compaction_defer_reset() to encapsulate this
      functionality and make it easier to understand the code.  No functional
      change.
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Reviewed-by: default avatarRik van Riel <riel@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      de6c60a6
    • Mel Gorman's avatar
      mm: compaction: trace compaction begin and end · 0eb927c0
      Mel Gorman authored
      The broad goal of the series is to improve allocation success rates for
      huge pages through memory compaction, while trying not to increase the
      compaction overhead.  The original objective was to reintroduce
      capturing of high-order pages freed by the compaction, before they are
      split by concurrent activity.  However, several bugs and opportunities
      for simple improvements were found in the current implementation, mostly
      through extra tracepoints (which are however too ugly for now to be
      considered for sending).
      
      The patches mostly deal with two mechanisms that reduce compaction
      overhead, which is caching the progress of migrate and free scanners,
      and marking pageblocks where isolation failed to be skipped during
      further scans.
      
      Patch 1 (from mgorman) adds tracepoints that allow calculate time spent in
              compaction and potentially debug scanner pfn values.
      
      Patch 2 encapsulates the some functionality for handling deferred compactions
              for better maintainability, without a functional change
              type is not determined without being actually needed.
      
      Patch 3 fixes a bug where cached scanner pfn's are sometimes reset only after
              they have been read to initialize a compaction run.
      
      Patch 4 fixes a bug where scanners meeting is sometimes not properly detected
              and can lead to multiple compaction attempts quitting early without
              doing any work.
      
      Patch 5 improves the chances of sync compaction to process pageblocks that
              async compaction has skipped due to being !MIGRATE_MOVABLE.
      
      Patch 6 improves the chances of sync direct compaction to actually do anything
              when called after async compaction fails during allocation slowpath.
      
      The impact of patches were validated using mmtests's stress-highalloc
      benchmark with mmtests's stress-highalloc benchmark on a x86_64 machine
      with 4GB memory.
      
      Due to instability of the results (mostly related to the bugs fixed by
      patches 2 and 3), 10 iterations were performed, taking min,mean,max
      values for success rates and mean values for time and vmstat-based
      metrics.
      
      First, the default GFP_HIGHUSER_MOVABLE allocations were tested with the
      patches stacked on top of v3.13-rc2.  Patch 2 is OK to serve as baseline
      due to no functional changes in 1 and 2.  Comments below.
      
      stress-highalloc
                                   3.13-rc2              3.13-rc2              3.13-rc2              3.13-rc2              3.13-rc2
                                    2-nothp               3-nothp               4-nothp               5-nothp               6-nothp
      Success 1 Min          9.00 (  0.00%)       10.00 (-11.11%)       43.00 (-377.78%)       43.00 (-377.78%)       33.00 (-266.67%)
      Success 1 Mean        27.50 (  0.00%)       25.30 (  8.00%)       45.50 (-65.45%)       45.90 (-66.91%)       46.30 (-68.36%)
      Success 1 Max         36.00 (  0.00%)       36.00 (  0.00%)       47.00 (-30.56%)       48.00 (-33.33%)       52.00 (-44.44%)
      Success 2 Min         10.00 (  0.00%)        8.00 ( 20.00%)       46.00 (-360.00%)       45.00 (-350.00%)       35.00 (-250.00%)
      Success 2 Mean        26.40 (  0.00%)       23.50 ( 10.98%)       47.30 (-79.17%)       47.60 (-80.30%)       48.10 (-82.20%)
      Success 2 Max         34.00 (  0.00%)       33.00 (  2.94%)       48.00 (-41.18%)       50.00 (-47.06%)       54.00 (-58.82%)
      Success 3 Min         65.00 (  0.00%)       63.00 (  3.08%)       85.00 (-30.77%)       84.00 (-29.23%)       85.00 (-30.77%)
      Success 3 Mean        76.70 (  0.00%)       70.50 (  8.08%)       86.20 (-12.39%)       85.50 (-11.47%)       86.00 (-12.13%)
      Success 3 Max         87.00 (  0.00%)       86.00 (  1.15%)       88.00 ( -1.15%)       87.00 (  0.00%)       87.00 (  0.00%)
      
                  3.13-rc2    3.13-rc2    3.13-rc2    3.13-rc2    3.13-rc2
                   2-nothp     3-nothp     4-nothp     5-nothp     6-nothp
      User         6437.72     6459.76     5960.32     5974.55     6019.67
      System       1049.65     1049.09     1029.32     1031.47     1032.31
      Elapsed      1856.77     1874.48     1949.97     1994.22     1983.15
      
                                    3.13-rc2    3.13-rc2    3.13-rc2    3.13-rc2    3.13-rc2
                                     2-nothp     3-nothp     4-nothp     5-nothp     6-nothp
      Minor Faults                 253952267   254581900   250030122   250507333   250157829
      Major Faults                       420         407         506         530         530
      Swap Ins                             4           9           9           6           6
      Swap Outs                          398         375         345         346         333
      Direct pages scanned            197538      189017      298574      287019      299063
      Kswapd pages scanned           1809843     1801308     1846674     1873184     1861089
      Kswapd pages reclaimed         1806972     1798684     1844219     1870509     1858622
      Direct pages reclaimed          197227      188829      298380      286822      298835
      Kswapd efficiency                  99%         99%         99%         99%         99%
      Kswapd velocity                953.382     970.449     952.243     934.569     922.286
      Direct efficiency                  99%         99%         99%         99%         99%
      Direct velocity                104.058     101.832     153.961     143.200     148.205
      Percentage direct scans             9%          9%         13%         13%         13%
      Zone normal velocity           347.289     359.676     348.063     339.933     332.983
      Zone dma32 velocity            710.151     712.605     758.140     737.835     737.507
      Zone dma velocity                0.000       0.000       0.000       0.000       0.000
      Page writes by reclaim         557.600     429.000     353.600     426.400     381.800
      Page writes file                   159          53           7          79          48
      Page writes anon                   398         375         345         346         333
      Page reclaim immediate             825         644         411         575         420
      Sector Reads                   2781750     2769780     2878547     2939128     2910483
      Sector Writes                 12080843    12083351    12012892    12002132    12010745
      Page rescued immediate               0           0           0           0           0
      Slabs scanned                  1575654     1545344     1778406     1786700     1794073
      Direct inode steals               9657       10037       15795       14104       14645
      Kswapd inode steals              46857       46335       50543       50716       51796
      Kswapd skipped wait                  0           0           0           0           0
      THP fault alloc                     97          91          81          71          77
      THP collapse alloc                 456         506         546         544         565
      THP splits                           6           5           5           4           4
      THP fault fallback                   0           1           0           0           0
      THP collapse fail                   14          14          12          13          12
      Compaction stalls                 1006         980        1537        1536        1548
      Compaction success                 303         284         562         559         578
      Compaction failures                702         696         974         976         969
      Page migrate success           1177325     1070077     3927538     3781870     3877057
      Page migrate failure                 0           0           0           0           0
      Compaction pages isolated      2547248     2306457     8301218     8008500     8200674
      Compaction migrate scanned    42290478    38832618   153961130   154143900   159141197
      Compaction free scanned       89199429    79189151   356529027   351943166   356326727
      Compaction cost                   1566        1426        5312        5156        5294
      NUMA PTE updates                     0           0           0           0           0
      NUMA hint faults                     0           0           0           0           0
      NUMA hint local faults               0           0           0           0           0
      NUMA hint local percent            100         100         100         100         100
      NUMA pages migrated                  0           0           0           0           0
      AutoNUMA cost                        0           0           0           0           0
      
      Observations:
      
      - The "Success 3" line is allocation success rate with system idle
        (phases 1 and 2 are with background interference).  I used to get stable
        values around 85% with vanilla 3.11.  The lower min and mean values came
        with 3.12.  This was bisected to commit 81c0a2bb ("mm: page_alloc: fair
        zone allocator policy") As explained in comment for patch 3, I don't
        think the commit is wrong, but that it makes the effect of compaction
        bugs worse.  From patch 3 onwards, the results are OK and match the 3.11
        results.
      
      - Patch 4 also clearly helps phases 1 and 2, and exceeds any results
        I've seen with 3.11 (I didn't measure it that thoroughly then, but it
        was never above 40%).
      
      - Compaction cost and number of scanned pages is higher, especially due
        to patch 4.  However, keep in mind that patches 3 and 4 fix existing
        bugs in the current design of compaction overhead mitigation, they do
        not change it.  If overhead is found unacceptable, then it should be
        decreased differently (and consistently, not due to random conditions)
        than the current implementation does.  In contrast, patches 5 and 6
        (which are not strictly bug fixes) do not increase the overhead (but
        also not success rates).  This might be a limitation of the
        stress-highalloc benchmark as it's quite uniform.
      
      Another set of results is when configuring stress-highalloc t allocate
      with similar flags as THP uses:
       (GFP_HIGHUSER_MOVABLE|__GFP_NOMEMALLOC|__GFP_NORETRY|__GFP_NO_KSWAPD)
      
      stress-highalloc
                                   3.13-rc2              3.13-rc2              3.13-rc2              3.13-rc2              3.13-rc2
                                      2-thp                 3-thp                 4-thp                 5-thp                 6-thp
      Success 1 Min          2.00 (  0.00%)        7.00 (-250.00%)       18.00 (-800.00%)       19.00 (-850.00%)       26.00 (-1200.00%)
      Success 1 Mean        19.20 (  0.00%)       17.80 (  7.29%)       29.20 (-52.08%)       29.90 (-55.73%)       32.80 (-70.83%)
      Success 1 Max         27.00 (  0.00%)       29.00 ( -7.41%)       35.00 (-29.63%)       36.00 (-33.33%)       37.00 (-37.04%)
      Success 2 Min          3.00 (  0.00%)        8.00 (-166.67%)       21.00 (-600.00%)       21.00 (-600.00%)       32.00 (-966.67%)
      Success 2 Mean        19.30 (  0.00%)       17.90 (  7.25%)       32.20 (-66.84%)       32.60 (-68.91%)       35.70 (-84.97%)
      Success 2 Max         27.00 (  0.00%)       30.00 (-11.11%)       36.00 (-33.33%)       37.00 (-37.04%)       39.00 (-44.44%)
      Success 3 Min         62.00 (  0.00%)       62.00 (  0.00%)       85.00 (-37.10%)       75.00 (-20.97%)       64.00 ( -3.23%)
      Success 3 Mean        66.30 (  0.00%)       65.50 (  1.21%)       85.60 (-29.11%)       83.40 (-25.79%)       83.50 (-25.94%)
      Success 3 Max         70.00 (  0.00%)       69.00 (  1.43%)       87.00 (-24.29%)       86.00 (-22.86%)       87.00 (-24.29%)
      
                  3.13-rc2    3.13-rc2    3.13-rc2    3.13-rc2    3.13-rc2
                     2-thp       3-thp       4-thp       5-thp       6-thp
      User         6547.93     6475.85     6265.54     6289.46     6189.96
      System       1053.42     1047.28     1043.23     1042.73     1038.73
      Elapsed      1835.43     1821.96     1908.67     1912.74     1956.38
      
                                    3.13-rc2    3.13-rc2    3.13-rc2    3.13-rc2    3.13-rc2
                                       2-thp       3-thp       4-thp       5-thp       6-thp
      Minor Faults                 256805673   253106328   253222299   249830289   251184418
      Major Faults                       395         375         423         434         448
      Swap Ins                            12          10          10          12           9
      Swap Outs                          530         537         487         455         415
      Direct pages scanned             71859       86046      153244      152764      190713
      Kswapd pages scanned           1900994     1870240     1898012     1892864     1880520
      Kswapd pages reclaimed         1897814     1867428     1894939     1890125     1877924
      Direct pages reclaimed           71766       85908      153167      152643      190600
      Kswapd efficiency                  99%         99%         99%         99%         99%
      Kswapd velocity               1029.000    1067.782    1000.091     991.049     951.218
      Direct efficiency                  99%         99%         99%         99%         99%
      Direct velocity                 38.897      49.127      80.747      79.983      96.468
      Percentage direct scans             3%          4%          7%          7%          9%
      Zone normal velocity           351.377     372.494     348.910     341.689     335.310
      Zone dma32 velocity            716.520     744.414     731.928     729.343     712.377
      Zone dma velocity                0.000       0.000       0.000       0.000       0.000
      Page writes by reclaim         669.300     604.000     545.700     538.900     429.900
      Page writes file                   138          66          58          83          14
      Page writes anon                   530         537         487         455         415
      Page reclaim immediate             806         655         772         548         517
      Sector Reads                   2711956     2703239     2811602     2818248     2839459
      Sector Writes                 12163238    12018662    12038248    11954736    11994892
      Page rescued immediate               0           0           0           0           0
      Slabs scanned                  1385088     1388364     1507968     1513292     1558656
      Direct inode steals               1739        2564        4622        5496        6007
      Kswapd inode steals              47461       46406       47804       48013       48466
      Kswapd skipped wait                  0           0           0           0           0
      THP fault alloc                    110          82          84          69          70
      THP collapse alloc                 445         482         467         462         539
      THP splits                           6           5           4           5           3
      THP fault fallback                   3           0           0           0           0
      THP collapse fail                   15          14          14          14          13
      Compaction stalls                  659         685        1033        1073        1111
      Compaction success                 222         225         410         427         456
      Compaction failures                436         460         622         646         655
      Page migrate success            446594      439978     1085640     1095062     1131716
      Page migrate failure                 0           0           0           0           0
      Compaction pages isolated      1029475     1013490     2453074     2482698     2565400
      Compaction migrate scanned     9955461    11344259    24375202    27978356    30494204
      Compaction free scanned       27715272    28544654    80150615    82898631    85756132
      Compaction cost                    552         555        1344        1379        1436
      NUMA PTE updates                     0           0           0           0           0
      NUMA hint faults                     0           0           0           0           0
      NUMA hint local faults               0           0           0           0           0
      NUMA hint local percent            100         100         100         100         100
      NUMA pages migrated                  0           0           0           0           0
      AutoNUMA cost                        0           0           0           0           0
      
      There are some differences from the previous results for THP-like allocations:
      
      - Here, the bad result for unpatched kernel in phase 3 is much more
        consistent to be between 65-70% and not related to the "regression" in
        3.12.  Still there is the improvement from patch 4 onwards, which brings
        it on par with simple GFP_HIGHUSER_MOVABLE allocations.
      
      - Compaction costs have increased, but nowhere near as much as the
        non-THP case.  Again, the patches should be worth the gained
        determininsm.
      
      - Patches 5 and 6 somewhat increase the number of migrate-scanned pages.
         This is most likely due to __GFP_NO_KSWAPD flag, which means the cached
        pfn's and pageblock skip bits are not reset by kswapd that often (at
        least in phase 3 where no concurrent activity would wake up kswapd) and
        the patches thus help the sync-after-async compaction.  It doesn't
        however show that the sync compaction would help so much with success
        rates, which can be again seen as a limitation of the benchmark
        scenario.
      
      This patch (of 6):
      
      Add two tracepoints for compaction begin and end of a zone.  Using this it
      is possible to calculate how much time a workload is spending within
      compaction and potentially debug problems related to cached pfns for
      scanning.  In combination with the direct reclaim and slab trace points it
      should be possible to estimate most allocation-related overhead for a
      workload.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0eb927c0
    • Michal Hocko's avatar
      memcg, oom: lock mem_cgroup_print_oom_info · 947b3dd1
      Michal Hocko authored
      mem_cgroup_print_oom_info uses a static buffer (memcg_name) to store the
      name of the cgroup.  This is not safe as pointed out by David Rientjes
      because memcg oom is locked only for its hierarchy and nothing prevents
      another parallel hierarchy to trigger oom as well and overwrite the
      already in-use buffer.
      
      This patch introduces oom_info_lock hidden inside
      mem_cgroup_print_oom_info which is held throughout the function.  It
      makes access to memcg_name safe and as a bonus it also prevents parallel
      memcg ooms to interleave their statistics which would make the printed
      data hard to analyze otherwise.
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.cz>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      947b3dd1
    • Mel Gorman's avatar
      sched: add tracepoints related to NUMA task migration · 286549dc
      Mel Gorman authored
      This patch adds three tracepoints
       o trace_sched_move_numa	when a task is moved to a node
       o trace_sched_swap_numa	when a task is swapped with another task
       o trace_sched_stick_numa	when a numa-related migration fails
      
      The tracepoints allow the NUMA scheduler activity to be monitored and the
      following high-level metrics can be calculated
      
       o NUMA migrated stuck	 nr trace_sched_stick_numa
       o NUMA migrated idle	 nr trace_sched_move_numa
       o NUMA migrated swapped nr trace_sched_swap_numa
       o NUMA local swapped	 trace_sched_swap_numa src_nid == dst_nid (should never happen)
       o NUMA remote swapped	 trace_sched_swap_numa src_nid != dst_nid (should == NUMA migrated swapped)
       o NUMA group swapped	 trace_sched_swap_numa src_ngid == dst_ngid
      			 Maybe a small number of these are acceptable
      			 but a high number would be a major surprise.
      			 It would be even worse if bounces are frequent.
       o NUMA avg task migs.	 Average number of migrations for tasks
       o NUMA stddev task mig	 Self-explanatory
       o NUMA max task migs.	 Maximum number of migrations for a single task
      
      In general the intent of the tracepoints is to help diagnose problems
      where automatic NUMA balancing appears to be doing an excessive amount
      of useless work.
      
      [akpm@linux-foundation.org: remove semicolon-after-if, repair coding-style]
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Reviewed-by: default avatarRik van Riel <riel@redhat.com>
      Cc: Alex Thorlton <athorlton@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      286549dc
    • Mel Gorman's avatar
      mm: numa: do not automatically migrate KSM pages · 64a9a34e
      Mel Gorman authored
      KSM pages can be shared between tasks that are not necessarily related
      to each other from a NUMA perspective.  This patch causes those pages to
      be ignored by automatic NUMA balancing so they do not migrate and do not
      cause unrelated tasks to be grouped together.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Reviewed-by: default avatarRik van Riel <riel@redhat.com>
      Cc: Alex Thorlton <athorlton@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      64a9a34e
    • Mel Gorman's avatar
      mm: numa: trace tasks that fail migration due to rate limiting · af1839d7
      Mel Gorman authored
      A low local/remote numa hinting fault ratio is potentially explained by
      failed migrations.  This patch adds a tracepoint that fires when
      migration fails due to migration rate limitation.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Reviewed-by: default avatarRik van Riel <riel@redhat.com>
      Cc: Alex Thorlton <athorlton@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      af1839d7
    • Mel Gorman's avatar
      mm: numa: limit scope of lock for NUMA migrate rate limiting · 1c5e9c27
      Mel Gorman authored
      NUMA migrate rate limiting protects a migration counter and window using
      a lock but in some cases this can be a contended lock.  It is not
      critical that the number of pages be perfect, lost updates are
      acceptable.  Reduce the importance of this lock.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Reviewed-by: default avatarRik van Riel <riel@redhat.com>
      Cc: Alex Thorlton <athorlton@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1c5e9c27
    • Mel Gorman's avatar
      mm: numa: make NUMA-migrate related functions static · 1c30e017
      Mel Gorman authored
      numamigrate_update_ratelimit and numamigrate_isolate_page only have
      callers in mm/migrate.c.  This patch makes them static.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Reviewed-by: default avatarRik van Riel <riel@redhat.com>
      Cc: Alex Thorlton <athorlton@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1c30e017
    • Xishi Qiu's avatar
      lib/show_mem.c: show num_poisoned_pages when oom · 25487d73
      Xishi Qiu authored
      Show num_poisoned_pages when oom, it is a little helpful to find the
      reason.  Also it will be emitted anytime show_mem() is called.
      Signed-off-by: default avatarXishi Qiu <qiuxishi@huawei.com>
      Suggested-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Reviewed-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Acked-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      25487d73
    • Wanpeng Li's avatar
      mm/hwpoison: add '#' to hwpoison_inject · 4883e997
      Wanpeng Li authored
      Add '#' to hwpoison_inject just as done in madvise_hwpoison.
      Signed-off-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Reviewed-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Reviewed-by: default avatarVladimir Murzin <murzin.v@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4883e997
    • Grygorii Strashko's avatar
      mm/memblock: use WARN_ONCE when MAX_NUMNODES passed as input parameter · 560dca27
      Grygorii Strashko authored
      Check nid parameter and produce warning if it has deprecated
      MAX_NUMNODES value.  Also re-assign NUMA_NO_NODE value to the nid
      parameter in this case.
      
      These will help to identify the wrong API usage (the caller) and make
      code simpler.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      560dca27
    • Grygorii Strashko's avatar
      x86/mm: memblock: switch to use NUMA_NO_NODE · 9a28f9dc
      Grygorii Strashko authored
      Update X86 code to use NUMA_NO_NODE instead of MAX_NUMNODES while
      calling memblock APIs, because memblock API will be changed to use
      NUMA_NO_NODE and will produce warning during boot otherwise.
      
      See:
       https://lkml.org/lkml/2013/12/9/898Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9a28f9dc