summary refs log tree commit diff
path: root/block
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2016-05-09 17:22:15 -0700
committerJens Axboe <axboe@fb.com>2016-05-10 08:41:37 -0600
commit59fa0224cfea31dde596e29555de94c961b139f9 (patch)
tree4d0812a3b897bc9f1ad1ca45bd156141b5c8b946 /block
parent8d1547e08dda8848f01185b3fd6bb946b68de99f (diff)
downloadlinux-59fa0224cfea31dde596e29555de94c961b139f9.tar.gz
blk-throttle: don't parse cgroup path if trace isn't enabled
if trace isn't enabled, parsing cgroup path just wastes cpu

Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-throttle.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 2149a1ddbacf..47a3e540631a 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -211,15 +211,14 @@ static struct throtl_data *sq_to_td(struct throtl_service_queue *sq)
  *
  * The messages are prefixed with "throtl BLKG_NAME" if @sq belongs to a
  * throtl_grp; otherwise, just "throtl".
- *
- * TODO: this should be made a function and name formatting should happen
- * after testing whether blktrace is enabled.
  */
 #define throtl_log(sq, fmt, args...)	do {				\
 	struct throtl_grp *__tg = sq_to_tg((sq));			\
 	struct throtl_data *__td = sq_to_td((sq));			\
 									\
 	(void)__td;							\
+	if (likely(!blk_trace_note_message_enabled(__td->queue)))	\
+		break;							\
 	if ((__tg)) {							\
 		char __pbuf[128];					\
 									\