vm: fix vm_pgoff wrap in stack expansion

    commit a626ca6a656450e9f4df91d0dda238fff23285f4 upstream.

    Commit 982134ba6261 ("mm: avoid wrapping vm_pgoff in mremap()") fixed
    the case of a expanding mapping causing vm_pgoff wrapping when you used
    mremap.  But there was another case where we expand mappings hiding in
    plain sight: the automatic stack expansion.

    This fixes that case too.

    This one also found by Robert Święcki, using his nasty system call
    fuzzer tool.  Good job.

    Reported-and-tested-by: Robert Święcki <robert@swiecki.net>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
vmscan: prevent background aging of anon page in no swap system
writeback: do uninterruptible sleep in balance_dirty_pages()

Using TASK_INTERRUPTIBLE in balance_dirty_pages() seems wrong.  If it's
going to do that then it must break out if signal_pending(), otherwise
it's pretty much guaranteed to degenerate into a busywait loop.  Plus we
*do* want these processes to appear in D state and to contribute to load
average.

So it should be TASK_UNINTERRUPTIBLE.                 -- Andrew Morton

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
deactivate invalidated pages

Recently, there are reported problem about thrashing.
(http://marc.info/?l=rsync&amp;m=128885034930933&amp;w=2)
It happens by backup workloads(ex, nightly rsync).
That's because the workload makes just use-once pages
and touches pages twice. It promotes the page into
active list so that it results in working set page eviction.

Some app developer want to support POSIX_FADV_NOREUSE.
But other OSes don't support it, either.
(http://marc.info/?l=linux-mm&amp;m=128928979512086&amp;w=2)

By other approach, app developers use POSIX_FADV_DONTNEED.
But it has a problem. If kernel meets page is writing
during invalidate_mapping_pages, it can't work.
It makes for application programmer to use it since they always
have to sync data before calling fadivse(..POSIX_FADV_DONTNEED) to
make sure the pages could be discardable. At last, they can't use
deferred write of kernel so that they could see performance loss.
(http://insights.oetiker.ch/linux/fadvise.html)

In fact, invalidation is very big hint to reclaimer.
It means we don't use the page any more. So let's move
the writing page into inactive list's head if we can't truncate
it right now.

Why I move page to head of lru on this patch, Dirty/Writeback page
would be flushed sooner or later. It can prevent writeout of pageout
which is less effective than flusher's writeout.

Originally, I reused lru_demote of Peter with some change so added
his Signed-off-by.

Reported-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Nick Piggin <npiggin@kernel.dk>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
vmscan: move referenced VM_EXEC pages to active list

    In commit 64574746, "vmscan: detect mapped file pages used only once",
    Johannes Weiner, added logic to page_check_reference to cycle again
    used once pages.

    In commit 8cab4754, "vmscan: make mapped executable pages the first
    class citizen", Wu Fengguang, added logic to shrink_active_list which
    protects file-backed VM_EXEC pages by keeping them in the active_list if
    they are referenced.

    This patch adds logic to move such pages from the inactive list to the
    active list immediately if they have been referenced. If a VM_EXEC page
    is seen as referenced during an inactive list scan, that reference must
    have occurred after the page was put on the inactive list. There is no
    need to wait for the page to be referenced again.
mm: Allow compaction without HugeTLB

    Memory compaction can be enabled without enabling
    HUGETLB support.

    Change-Id: I449ee24205f8139dbe0c198b045c5a66917801b2
    Signed-off-by: Brian Steuer <bsteuer@codeaurora.org>
ADD: Frontswap

Conflicts:

	mm/Kconfig
mm: check PageUnevictable in lru_deactivate_fn()

    The lru_deactivate_fn should not move page which in on unevictable lru
    into inactive list.  Otherwise, we can meet BUG when we use
    isolate_lru_pages as __isolate_lru_page could return -EINVAL.

    Reported-by: Ying Han <yinghan@google.com>
    Tested-by: Ying Han <yinghan@google.com>
    Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
    Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Reviewed-by: Rik van Riel<riel@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm: filter unevictable page out in deactivate_page()

    It's pointless that deactive_page's operates on unevictable pages.  This
    patch removes unnecessary overhead which might be a bit problem in case
    that there are many unevictable page in system(ex, mprotect workload)

    [akpm@linux-foundation.org: tidy up comment]
    Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
    Reviewed-by: Rik van Riel<riel@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
cgroups: read-write lock CLONE_THREAD forking per threadgroup
cgroup: remove the ns_cgroup
sched: Rate-limit nohz
incorrect unlikely() and likely() cleanups (Signed-off-by:

Steven Rostedt)