aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2015-06-12 14:15:54 -0400
committerBob Peterson <rpeterso@redhat.com>2015-06-18 13:17:59 -0400
commite7ccaf5fe1590667b3fa2f8df5c5ec9ba0dc5b85 (patch)
tree168c1f810fac94f8696fa491bee923e42d1677b7
parent86066914edff2316cbed63aac8a87d5001441a16 (diff)
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 <rpeterso@redhat.com> Acked-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/glock.c3
-rw-r--r--fs/gfs2/glops.c6
-rw-r--r--fs/gfs2/incore.h1
3 files changed, 7 insertions, 3 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 0fa8062f85a7..a38e38f7b6fc 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1076,7 +1076,8 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
1076 !test_bit(GLF_DEMOTE, &gl->gl_flags)) 1076 !test_bit(GLF_DEMOTE, &gl->gl_flags))
1077 fast_path = 1; 1077 fast_path = 1;
1078 } 1078 }
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))
1080 gfs2_glock_add_to_lru(gl); 1081 gfs2_glock_add_to_lru(gl);
1081 1082
1082 trace_gfs2_glock_queue(gh, 0); 1083 trace_gfs2_glock_queue(gh, 0);
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index fe91951c3361..1249b2bb2830 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -561,7 +561,7 @@ const struct gfs2_glock_operations gfs2_inode_glops = {
561 .go_lock = inode_go_lock, 561 .go_lock = inode_go_lock,
562 .go_dump = inode_go_dump, 562 .go_dump = inode_go_dump,
563 .go_type = LM_TYPE_INODE, 563 .go_type = LM_TYPE_INODE,
564 .go_flags = GLOF_ASPACE, 564 .go_flags = GLOF_ASPACE | GLOF_LRU,
565}; 565};
566 566
567const struct gfs2_glock_operations gfs2_rgrp_glops = { 567const struct gfs2_glock_operations gfs2_rgrp_glops = {
@@ -584,10 +584,12 @@ const struct gfs2_glock_operations gfs2_freeze_glops = {
584const struct gfs2_glock_operations gfs2_iopen_glops = { 584const struct gfs2_glock_operations gfs2_iopen_glops = {
585 .go_type = LM_TYPE_IOPEN, 585 .go_type = LM_TYPE_IOPEN,
586 .go_callback = iopen_go_callback, 586 .go_callback = iopen_go_callback,
587 .go_flags = GLOF_LRU,
587}; 588};
588 589
589const struct gfs2_glock_operations gfs2_flock_glops = { 590const struct gfs2_glock_operations gfs2_flock_glops = {
590 .go_type = LM_TYPE_FLOCK, 591 .go_type = LM_TYPE_FLOCK,
592 .go_flags = GLOF_LRU,
591}; 593};
592 594
593const struct gfs2_glock_operations gfs2_nondisk_glops = { 595const struct gfs2_glock_operations gfs2_nondisk_glops = {
@@ -596,7 +598,7 @@ const struct gfs2_glock_operations gfs2_nondisk_glops = {
596 598
597const struct gfs2_glock_operations gfs2_quota_glops = { 599const struct gfs2_glock_operations gfs2_quota_glops = {
598 .go_type = LM_TYPE_QUOTA, 600 .go_type = LM_TYPE_QUOTA,
599 .go_flags = GLOF_LVB, 601 .go_flags = GLOF_LVB | GLOF_LRU,
600}; 602};
601 603
602const struct gfs2_glock_operations gfs2_journal_glops = { 604const struct gfs2_glock_operations gfs2_journal_glops = {
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 304a22315448..a1ec7c20e498 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -225,6 +225,7 @@ struct gfs2_glock_operations {
225 const unsigned long go_flags; 225 const unsigned long go_flags;
226#define GLOF_ASPACE 1 226#define GLOF_ASPACE 1
227#define GLOF_LVB 2 227#define GLOF_LVB 2
228#define GLOF_LRU 4
228}; 229};
229 230
230enum { 231enum {