diff options
author | Brian Behlendorf <[email protected]> | 2012-05-01 15:49:07 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-05-07 11:54:19 -0700 |
commit | 06089b9e1929440e07a9eb7a11e68197a4ab40f2 (patch) | |
tree | 6fe5fc98798e33f0451ef545e367716c5bdfcb91 /module/spl/spl-kmem.c | |
parent | c0e0fc14e3e65e519849dd9fbfb94a6c79d0d149 (diff) |
Ensure direct reclaim forward progress
The Linux direct reclaim path uses this out of band value to
determine if forward progress is being made. Normally this is
incremented by kmem_freepages() which is part of the various
Linux slab implementations. However, since we are using none
of that infrastructure we're responsible for incrementing this
count.
If no forward progress is detected and a subsequent allocation
fails the OOM killer will be invoked. If there was forward
progress additional reclaim will be attempted via the page
cache and registerd shrinker until the allocation succeeds.
Signed-off-by: Prakash Surya <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #107
Diffstat (limited to 'module/spl/spl-kmem.c')
-rw-r--r-- | module/spl/spl-kmem.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 361030b18..f7d5f7e86 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -880,6 +880,16 @@ kv_free(spl_kmem_cache_t *skc, void *ptr, int size) ASSERT(IS_P2ALIGNED(ptr, PAGE_SIZE)); ASSERT(ISP2(size)); + /* + * The Linux direct reclaim path uses this out of band value to + * determine if forward progress is being made. Normally this is + * incremented by kmem_freepages() which is part of the various + * Linux slab implementations. However, since we are using none + * of that infrastructure we are responsible for incrementing it. + */ + if (current->reclaim_state) + current->reclaim_state->reclaimed_slab += size >> PAGE_SHIFT; + if (skc->skc_flags & KMC_KMEM) free_pages((unsigned long)ptr, get_order(size)); else |