aboutsummaryrefslogtreecommitdiffstats
path: root/mm/z3fold.c
diff options
context:
space:
mode:
authorVitaly Wool <vitalywool@gmail.com>2018-05-11 16:01:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-05-11 17:28:45 -0700
commit6098d7e136692f9c6e23ae362c62ec822343e4d5 (patch)
tree5d57adcfc8b45d6455ddd9c0e0526f2b8bb281a5 /mm/z3fold.c
parentae646f0b9ca135b87bc73ff606ef996c3029780a (diff)
downloadnet-6098d7e136692f9c6e23ae362c62ec822343e4d5.tar.gz
z3fold: fix reclaim lock-ups
Do not try to optimize in-page object layout while the page is under reclaim. This fixes lock-ups on reclaim and improves reclaim performance at the same time. [akpm@linux-foundation.org: coding-style fixes] Link: http://lkml.kernel.org/r/20180430125800.444cae9706489f412ad12621@gmail.com Signed-off-by: Vitaly Wool <vitaly.vul@sony.com> Reported-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Cc: <Oleksiy.Avramchenko@sony.com> Cc: Matthew Wilcox <mawilcox@microsoft.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/z3fold.c')
-rw-r--r--mm/z3fold.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/mm/z3fold.c b/mm/z3fold.c
index c0bca6153b95d2..4b366d181f35d1 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -144,7 +144,8 @@ enum z3fold_page_flags {
PAGE_HEADLESS = 0,
MIDDLE_CHUNK_MAPPED,
NEEDS_COMPACTING,
- PAGE_STALE
+ PAGE_STALE,
+ UNDER_RECLAIM
};
/*****************
@@ -173,6 +174,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page,
clear_bit(MIDDLE_CHUNK_MAPPED, &page->private);
clear_bit(NEEDS_COMPACTING, &page->private);
clear_bit(PAGE_STALE, &page->private);
+ clear_bit(UNDER_RECLAIM, &page->private);
spin_lock_init(&zhdr->page_lock);
kref_init(&zhdr->refcount);
@@ -756,6 +758,10 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle)
atomic64_dec(&pool->pages_nr);
return;
}
+ if (test_bit(UNDER_RECLAIM, &page->private)) {
+ z3fold_page_unlock(zhdr);
+ return;
+ }
if (test_and_set_bit(NEEDS_COMPACTING, &page->private)) {
z3fold_page_unlock(zhdr);
return;
@@ -840,6 +846,8 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries)
kref_get(&zhdr->refcount);
list_del_init(&zhdr->buddy);
zhdr->cpu = -1;
+ set_bit(UNDER_RECLAIM, &page->private);
+ break;
}
list_del_init(&page->lru);
@@ -887,25 +895,35 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries)
goto next;
}
next:
- spin_lock(&pool->lock);
if (test_bit(PAGE_HEADLESS, &page->private)) {
if (ret == 0) {
- spin_unlock(&pool->lock);
free_z3fold_page(page);
return 0;
}
- } else if (kref_put(&zhdr->refcount, release_z3fold_page)) {
- atomic64_dec(&pool->pages_nr);
+ spin_lock(&pool->lock);
+ list_add(&page->lru, &pool->lru);
+ spin_unlock(&pool->lock);
+ } else {
+ z3fold_page_lock(zhdr);
+ clear_bit(UNDER_RECLAIM, &page->private);
+ if (kref_put(&zhdr->refcount,
+ release_z3fold_page_locked)) {
+ atomic64_dec(&pool->pages_nr);
+ return 0;
+ }
+ /*
+ * if we are here, the page is still not completely
+ * free. Take the global pool lock then to be able
+ * to add it back to the lru list
+ */
+ spin_lock(&pool->lock);
+ list_add(&page->lru, &pool->lru);
spin_unlock(&pool->lock);
- return 0;
+ z3fold_page_unlock(zhdr);
}
- /*
- * Add to the beginning of LRU.
- * Pool lock has to be kept here to ensure the page has
- * not already been released
- */
- list_add(&page->lru, &pool->lru);
+ /* We started off locked to we need to lock the pool back */
+ spin_lock(&pool->lock);
}
spin_unlock(&pool->lock);
return -EAGAIN;
omeos-4.19__release/core47-82'>chromeos-4.19__release/core47-82 Intel wireless group's fork of linux.gitIntel wireless group
aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorNaveen Krishna Chatradhi <ch.naveen@samsung.com>2014-04-08 21:04:01 +0900
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-10 01:21:59 +0000
commitef6929d2031c32b010591cf74a6ec85eccbe58ee (patch)
tree9d7bdd9c90419e0a563e58cd70bf7ca3d4689c07 /arch
parent6905dfda8c2b3509045bd0477b26dc9912023fdd (diff)
downloadchromeos-ef6929d2031c32b010591cf74a6ec85eccbe58ee.tar.gz
ARM: dtsi: Remove G2D powerdomain node for Exynos542X
Lets remove the G2D Power Domain node for Exynos542x system. For the following resons 1. As the G2D device is not used in chrome system for Exynos542X 2. commit: f84afb67d96a302a741b02a957062c37950d220d "arm: exynos: Keep G2D PD enabled during sleep on Exynos542X" Keeps the device alive across S2R for Crypto to work. 3. Power measured across s2r with this change and without this change is similar BUG=chrome-os-partner:27880 TEST=built for pit/pi running suspend_stress_test works fine Change-Id: Ic57dcb516db550366f0688d965abc113b42f8594 Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/193840 Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Doug Anderson <dianders@chromium.org> Commit-Queue: Sonny Rao <sonnyrao@chromium.org>