1. 27 10月, 2010 1 次提交
    • W
      writeback: remove nonblocking/encountered_congestion references · 1b430bee
      Wu Fengguang 提交于
      This removes more dead code that was somehow missed by commit 0d99519e
      (writeback: remove unused nonblocking and congestion checks).  There are
      no behavior change except for the removal of two entries from one of the
      ext4 tracing interface.
      
      The nonblocking checks in ->writepages are no longer used because the
      flusher now prefer to block on get_request_wait() than to skip inodes on
      IO congestion.  The latter will lead to more seeky IO.
      
      The nonblocking checks in ->writepage are no longer used because it's
      redundant with the WB_SYNC_NONE check.
      
      We no long set ->nonblocking in VM page out and page migration, because
      a) it's effectively redundant with WB_SYNC_NONE in current code
      b) it's old semantic of "Don't get stuck on request queues" is mis-behavior:
         that would skip some dirty inodes on congestion and page out others, which
         is unfair in terms of LRU age.
      
      Inspired by Christoph Hellwig. Thanks!
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Sage Weil <sage@newdream.net>
      Cc: Steve French <sfrench@samba.org>
      Cc: Chris Mason <chris.mason@oracle.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1b430bee
  2. 23 9月, 2010 1 次提交
  3. 18 8月, 2010 1 次提交
  4. 11 8月, 2010 4 次提交
  5. 10 8月, 2010 16 次提交
  6. 21 7月, 2010 1 次提交
  7. 19 7月, 2010 1 次提交
    • D
      mm: add context argument to shrinker callback · 7f8275d0
      Dave Chinner 提交于
      The current shrinker implementation requires the registered callback
      to have global state to work from. This makes it difficult to shrink
      caches that are not global (e.g. per-filesystem caches). Pass the shrinker
      structure to the callback so that users can embed the shrinker structure
      in the context the shrinker needs to operate on and get back to it in the
      callback via container_of().
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      7f8275d0
  8. 05 6月, 2010 1 次提交
  9. 25 5月, 2010 6 次提交
  10. 07 4月, 2010 1 次提交
    • K
      mm: revert "vmscan: get_scan_ratio() cleanup" · d6da1a5a
      KOSAKI Motohiro 提交于
      Shaohua Li reported his tmpfs streaming I/O test can lead to make oom.
      The test uses a 6G tmpfs in a system with 3G memory.  In the tmpfs, there
      are 6 copies of kernel source and the test does kbuild for each copy.  His
      investigation shows the test has a lot of rotated anon pages and quite few
      file pages, so get_scan_ratio calculates percent[0] (i.e.  scanning
      percent for anon) to be zero.  Actually the percent[0] shoule be a big
      value, but our calculation round it to zero.
      
      Although before commit 84b18490 ("vmscan: get_scan_ratio() cleanup") , we
      have the same problem too.  But the old logic can rescue percent[0]==0
      case only when priority==0.  It had hided the real issue.  I didn't think
      merely streaming io can makes percent[0]==0 && priority==0 situation.  but
      I was wrong.
      
      So, definitely we have to fix such tmpfs streaming io issue.  but anyway I
      revert the regression commit at first.
      
      This reverts commit 84b18490.
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Reported-by: NShaohua Li <shaohua.li@intel.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d6da1a5a
  11. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  12. 07 3月, 2010 6 次提交
    • J
      vmscan: detect mapped file pages used only once · 64574746
      Johannes Weiner 提交于
      The VM currently assumes that an inactive, mapped and referenced file page
      is in use and promotes it to the active list.
      
      However, every mapped file page starts out like this and thus a problem
      arises when workloads create a stream of such pages that are used only for
      a short time.  By flooding the active list with those pages, the VM
      quickly gets into trouble finding eligible reclaim canditates.  The result
      is long allocation latencies and eviction of the wrong pages.
      
      This patch reuses the PG_referenced page flag (used for unmapped file
      pages) to implement a usage detection that scales with the speed of LRU
      list cycling (i.e.  memory pressure).
      
      If the scanner encounters those pages, the flag is set and the page cycled
      again on the inactive list.  Only if it returns with another page table
      reference it is activated.  Otherwise it is reclaimed as 'not recently
      used cache'.
      
      This effectively changes the minimum lifetime of a used-once mapped file
      page from a full memory cycle to an inactive list cycle, which allows it
      to occur in linear streams without affecting the stable working set of the
      system.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: NRik van Riel <riel@redhat.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: OSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      64574746
    • J
      vmscan: drop page_mapping_inuse() · 31c0569c
      Johannes Weiner 提交于
      page_mapping_inuse() is a historic predicate function for pages that are
      about to be reclaimed or deactivated.
      
      According to it, a page is in use when it is mapped into page tables OR
      part of swap cache OR backing an mmapped file.
      
      This function is used in combination with page_referenced(), which checks
      for young bits in ptes and the page descriptor itself for the
      PG_referenced bit.  Thus, checking for unmapped swap cache pages is
      meaningless as PG_referenced is not set for anonymous pages and unmapped
      pages do not have young ptes.  The test makes no difference.
      
      Protecting file pages that are not by themselves mapped but are part of a
      mapped file is also a historic leftover for short-lived things like the
      exec() code in libc.  However, the VM now does reference accounting and
      activation of pages at unmap time and thus the special treatment on
      reclaim is obsolete.
      
      This patch drops page_mapping_inuse() and switches the two callsites to
      use page_mapped() directly.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: NRik van Riel <riel@redhat.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: OSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      31c0569c
    • J
      vmscan: factor out page reference checks · dfc8d636
      Johannes Weiner 提交于
      The used-once mapped file page detection patchset.
      
      It is meant to help workloads with large amounts of shortly used file
      mappings, like rtorrent hashing a file or git when dealing with loose
      objects (git gc on a bigger site?).
      
      Right now, the VM activates referenced mapped file pages on first
      encounter on the inactive list and it takes a full memory cycle to
      reclaim them again.  When those pages dominate memory, the system
      no longer has a meaningful notion of 'working set' and is required
      to give up the active list to make reclaim progress.  Obviously,
      this results in rather bad scanning latencies and the wrong pages
      being reclaimed.
      
      This patch makes the VM be more careful about activating mapped file
      pages in the first place.  The minimum granted lifetime without
      another memory access becomes an inactive list cycle instead of the
      full memory cycle, which is more natural given the mentioned loads.
      
      This test resembles a hashing rtorrent process.  Sequentially, 32MB
      chunks of a file are mapped into memory, hashed (sha1) and unmapped
      again.  While this happens, every 5 seconds a process is launched and
      its execution time taken:
      
      	python2.4 -c 'import pydoc'
      	old: max=2.31s mean=1.26s (0.34)
      	new: max=1.25s mean=0.32s (0.32)
      
      	find /etc -type f
      	old: max=2.52s mean=1.44s (0.43)
      	new: max=1.92s mean=0.12s (0.17)
      
      	vim -c ':quit'
      	old: max=6.14s mean=4.03s (0.49)
      	new: max=3.48s mean=2.41s (0.25)
      
      	mplayer --help
      	old: max=8.08s mean=5.74s (1.02)
      	new: max=3.79s mean=1.32s (0.81)
      
      	overall hash time (stdev):
      	old: time=1192.30 (12.85) thruput=25.78mb/s (0.27)
      	new: time=1060.27 (32.58) thruput=29.02mb/s (0.88) (-11%)
      
      I also tested kernbench with regular IO streaming in the background to
      see whether the delayed activation of frequently used mapped file
      pages had a negative impact on performance in the presence of pressure
      on the inactive list.  The patch made no significant difference in
      timing, neither for kernbench nor for the streaming IO throughput.
      
      The first patch submission raised concerns about the cost of the extra
      faults for actually activated pages on machines that have no hardware
      support for young page table entries.
      
      I created an artificial worst case scenario on an ARM machine with
      around 300MHz and 64MB of memory to figure out the dimensions
      involved.  The test would mmap a file of 20MB, then
      
        1. touch all its pages to fault them in
        2. force one full scan cycle on the inactive file LRU
        -- old: mapping pages activated
        -- new: mapping pages inactive
        3. touch the mapping pages again
        -- old and new: fault exceptions to set the young bits
        4. force another full scan cycle on the inactive file LRU
        5. touch the mapping pages one last time
        -- new: fault exceptions to set the young bits
      
      The test showed an overall increase of 6% in time over 100 iterations
      of the above (old: ~212sec, new: ~225sec).  13 secs total overhead /
      (100 * 5k pages), ignoring the execution time of the test itself,
      makes for about 25us overhead for every page that gets actually
      activated.  Note:
      
        1. File mapping the size of one third of main memory, _completely_
        in active use across memory pressure - i.e., most pages referenced
        within one LRU cycle.  This should be rare to non-existant,
        especially on such embedded setups.
      
        2. Many huge activation batches.  Those batches only occur when the
        working set fluctuates.  If it changes completely between every full
        LRU cycle, you have problematic reclaim overhead anyway.
      
        3. Access of activated pages at maximum speed: sequential loads from
        every single page without doing anything in between.  In reality,
        the extra faults will get distributed between actual operations on
        the data.
      
      So even if a workload manages to get the VM into the situation of
      activating a third of memory in one go on such a setup, it will take
      2.2 seconds instead 2.1 without the patch.
      
      Comparing the numbers (and my user-experience over several months),
      I think this change is an overall improvement to the VM.
      
      Patch 1 is only refactoring to break up that ugly compound conditional
      in shrink_page_list() and make it easy to document and add new checks
      in a readable fashion.
      
      Patch 2 gets rid of the obsolete page_mapping_inuse().  It's not
      strictly related to #3, but it was in the original submission and is a
      net simplification, so I kept it.
      
      Patch 3 implements used-once detection of mapped file pages.
      
      This patch:
      
      Moving the big conditional into its own predicate function makes the code
      a bit easier to read and allows for better commenting on the checks
      one-by-one.
      
      This is just cleaning up, no semantics should have been changed.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: NRik van Riel <riel@redhat.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: OSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dfc8d636
    • K
      mm: restore zone->all_unreclaimable to independence word · 93e4a89a
      KOSAKI Motohiro 提交于
      commit e815af95 ("change all_unreclaimable zone member to flags") changed
      all_unreclaimable member to bit flag.  But it had an undesireble side
      effect.  free_one_page() is one of most hot path in linux kernel and
      increasing atomic ops in it can reduce kernel performance a bit.
      
      Thus, this patch revert such commit partially. at least
      all_unreclaimable shouldn't share memory word with other zone flags.
      
      [akpm@linux-foundation.org: fix patch interaction]
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: Huang Shijie <shijie8@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      93e4a89a
    • K
      mm, lockdep: annotate reclaim context to zone reclaim too · 76ca542d
      KOSAKI Motohiro 提交于
      Commit cf40bd16 ("lockdep: annotate reclaim context") introduced reclaim
      context annotation.  But it didn't annotate zone reclaim.  This patch do
      it.
      
      The point is, commit cf40bd16 annotate __alloc_pages_direct_reclaim but
      zone-reclaim doesn't use __alloc_pages_direct_reclaim.
      
      current call graph is
      
      __alloc_pages_nodemask
         get_page_from_freelist
             zone_reclaim()
         __alloc_pages_slowpath
             __alloc_pages_direct_reclaim
                 try_to_free_pages
      
      Actually, if zone_reclaim_mode=1, VM never call
      __alloc_pages_direct_reclaim in usual VM pressure.
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Reviewed-by: NMinchan Kim <minchan.kim@gmail.com>
      Acked-by: NNick Piggin <npiggin@suse.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      76ca542d
    • K
      vmscan: get_scan_ratio() cleanup · 84b18490
      KOSAKI Motohiro 提交于
      The get_scan_ratio() should have all scan-ratio related calculations.
      Thus, this patch move some calculation into get_scan_ratio.
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Reviewed-by: NRik van Riel <riel@redhat.com>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Reviewed-by: NMinchan Kim <minchan.kim@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      84b18490