Skip to content

Commit e7ccaf5

Browse files
committed
GFS2: Don't add all glocks to the lru
The glocks used for resource groups often come and go hundreds of thousands of times per second. Adding them to the lru list just adds unnecessary contention for the lru_lock spin_lock, especially considering we're almost certainly going to re-use the glock and take it back off the lru microseconds later. We never want the glock shrinker to cull them anyway. This patch adds a new bit in the glops that determines which glock types get put onto the lru list and which ones don't. Signed-off-by: Bob Peterson <[email protected]> Acked-by: Steven Whitehouse <[email protected]>
1 parent 8606691 commit e7ccaf5

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

fs/gfs2/glock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,8 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
10761076
!test_bit(GLF_DEMOTE, &gl->gl_flags))
10771077
fast_path = 1;
10781078
}
1079-
if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl))
1079+
if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl) &&
1080+
(glops->go_flags & GLOF_LRU))
10801081
gfs2_glock_add_to_lru(gl);
10811082

10821083
trace_gfs2_glock_queue(gh, 0);

fs/gfs2/glops.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ const struct gfs2_glock_operations gfs2_inode_glops = {
561561
.go_lock = inode_go_lock,
562562
.go_dump = inode_go_dump,
563563
.go_type = LM_TYPE_INODE,
564-
.go_flags = GLOF_ASPACE,
564+
.go_flags = GLOF_ASPACE | GLOF_LRU,
565565
};
566566

567567
const struct gfs2_glock_operations gfs2_rgrp_glops = {
@@ -584,10 +584,12 @@ const struct gfs2_glock_operations gfs2_freeze_glops = {
584584
const struct gfs2_glock_operations gfs2_iopen_glops = {
585585
.go_type = LM_TYPE_IOPEN,
586586
.go_callback = iopen_go_callback,
587+
.go_flags = GLOF_LRU,
587588
};
588589

589590
const struct gfs2_glock_operations gfs2_flock_glops = {
590591
.go_type = LM_TYPE_FLOCK,
592+
.go_flags = GLOF_LRU,
591593
};
592594

593595
const struct gfs2_glock_operations gfs2_nondisk_glops = {
@@ -596,7 +598,7 @@ const struct gfs2_glock_operations gfs2_nondisk_glops = {
596598

597599
const struct gfs2_glock_operations gfs2_quota_glops = {
598600
.go_type = LM_TYPE_QUOTA,
599-
.go_flags = GLOF_LVB,
601+
.go_flags = GLOF_LVB | GLOF_LRU,
600602
};
601603

602604
const struct gfs2_glock_operations gfs2_journal_glops = {

fs/gfs2/incore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ struct gfs2_glock_operations {
225225
const unsigned long go_flags;
226226
#define GLOF_ASPACE 1
227227
#define GLOF_LVB 2
228+
#define GLOF_LRU 4
228229
};
229230

230231
enum {

0 commit comments

Comments
 (0)