Skip to contentSkip to conversation

Btrfs: fix confusing worker helper info

RFC PATCH In review Liu Bo 2 participants 2 messages Sep 8, 2017 – Sep 13, 2017 Btrfs file system

lore
Share & tools
lore

Liu Bo

author
#0 lore raw

RFC PATCH 1/1 Btrfs: fix confusing worker helper info

We've seen the following backtrace stack in ftrace or dmesg log,

  kworker/u16:10-4244  [000] 241942.480955: function:             btrfs_put_ordered_extent
  kworker/u16:10-4244  [000] 241942.480956: kernel_stack:         <stack trace>

=> finish_ordered_fn (ffffffffa0384475)
=> btrfs_scrubparity_helper (ffffffffa03ca577) => btrfs_freespace_write_helper (ffffffffa03ca98e) => process_one_work (ffffffff81117b2f)
=> worker_thread (ffffffff81118c2a)
=> kthread (ffffffff81121de0)
=> ret_from_fork (ffffffff81d7087a)

btrfs_scrubparity_helper really shouldn't be shown up.

It's caused by compiler doing inline for our helper function, adding a noinline tag can fix that.

---
 fs/btrfs/async-thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/async-thread.c +1 -1
index ff0b0be..593709a 100644
@@ -67,7 +67,7 @@ struct btrfs_workqueue {
 static void normal_work_helper(struct btrfs_work *work);
 
 #define BTRFS_WORK_HELPER(name)					\
-void btrfs_##name(struct work_struct *arg)				\
+noinline void btrfs_##name(struct work_struct *arg)			\
 {									\
 	struct btrfs_work *work = container_of(arg, struct btrfs_work,	\
 					       normal_work);		\
Signature · 1 line
2.9.4
#1 lore raw
Quoted 12 lines · Liu Bo

We've seen the following backtrace stack in ftrace or dmesg log,

  kworker/u16:10-4244  [000] 241942.480955: function:             btrfs_put_ordered_extent
  kworker/u16:10-4244  [000] 241942.480956: kernel_stack:         <stack trace>

=> finish_ordered_fn (ffffffffa0384475)
=> btrfs_scrubparity_helper (ffffffffa03ca577) => btrfs_freespace_write_helper (ffffffffa03ca98e) => process_one_work (ffffffff81117b2f)
=> worker_thread (ffffffff81118c2a)
=> kthread (ffffffff81121de0)
=> ret_from_fork (ffffffff81d7087a)

Quoted 4 lines

btrfs_scrubparity_helper really shouldn't be shown up.

It's caused by compiler doing inline for our helper function, adding a noinline tag can fix that.

Isn't it the other way around then? Noninline would make the function object exist separately and then it would appear in the stacktrace. And I think this is desired, so you see the call stack withtou the shortcuts that the inlining can cause.