mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
GFS2: Shrink the shrinker
This patch removes some of the special cases that the shrinker was trying to deal with. As a result we leave fewer items on the list and none at all which cannot be demoted. This makes the list scanning more efficient and solves some issues seen with large numbers of inodes. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
4be3bd7849
commit
2163b1e616
1 changed files with 5 additions and 18 deletions
|
@ -1300,7 +1300,6 @@ static int gfs2_shrink_glock_memory(int nr, gfp_t gfp_mask)
|
||||||
struct gfs2_glock *gl;
|
struct gfs2_glock *gl;
|
||||||
int may_demote;
|
int may_demote;
|
||||||
int nr_skipped = 0;
|
int nr_skipped = 0;
|
||||||
int got_ref = 0;
|
|
||||||
LIST_HEAD(skipped);
|
LIST_HEAD(skipped);
|
||||||
|
|
||||||
if (nr == 0)
|
if (nr == 0)
|
||||||
|
@ -1318,7 +1317,6 @@ static int gfs2_shrink_glock_memory(int nr, gfp_t gfp_mask)
|
||||||
/* Test for being demotable */
|
/* Test for being demotable */
|
||||||
if (!test_and_set_bit(GLF_LOCK, &gl->gl_flags)) {
|
if (!test_and_set_bit(GLF_LOCK, &gl->gl_flags)) {
|
||||||
gfs2_glock_hold(gl);
|
gfs2_glock_hold(gl);
|
||||||
got_ref = 1;
|
|
||||||
spin_unlock(&lru_lock);
|
spin_unlock(&lru_lock);
|
||||||
spin_lock(&gl->gl_spin);
|
spin_lock(&gl->gl_spin);
|
||||||
may_demote = demote_ok(gl);
|
may_demote = demote_ok(gl);
|
||||||
|
@ -1327,25 +1325,14 @@ static int gfs2_shrink_glock_memory(int nr, gfp_t gfp_mask)
|
||||||
if (may_demote) {
|
if (may_demote) {
|
||||||
handle_callback(gl, LM_ST_UNLOCKED, 0);
|
handle_callback(gl, LM_ST_UNLOCKED, 0);
|
||||||
nr--;
|
nr--;
|
||||||
if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
|
|
||||||
gfs2_glock_put(gl);
|
|
||||||
got_ref = 0;
|
|
||||||
}
|
}
|
||||||
|
if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
|
||||||
|
gfs2_glock_put(gl);
|
||||||
spin_lock(&lru_lock);
|
spin_lock(&lru_lock);
|
||||||
if (may_demote)
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (list_empty(&gl->gl_lru) &&
|
|
||||||
(atomic_read(&gl->gl_ref) <= (2 + got_ref))) {
|
|
||||||
nr_skipped++;
|
|
||||||
list_add(&gl->gl_lru, &skipped);
|
|
||||||
}
|
|
||||||
if (got_ref) {
|
|
||||||
spin_unlock(&lru_lock);
|
|
||||||
gfs2_glock_put(gl);
|
|
||||||
spin_lock(&lru_lock);
|
|
||||||
got_ref = 0;
|
|
||||||
}
|
}
|
||||||
|
nr_skipped++;
|
||||||
|
list_add(&gl->gl_lru, &skipped);
|
||||||
}
|
}
|
||||||
list_splice(&skipped, &lru_list);
|
list_splice(&skipped, &lru_list);
|
||||||
atomic_add(nr_skipped, &lru_count);
|
atomic_add(nr_skipped, &lru_count);
|
||||||
|
|
Loading…
Add table
Reference in a new issue