return;
set_user_nice(current, lc->new_nice);
lc->need_restore = true;
+
+ trace_f2fs_priority_uplift(sem->sbi, sem->name, is_write, current,
+ NICE_TO_PRIO(lc->orig_nice), NICE_TO_PRIO(lc->new_nice));
}
-static void restore_priority(struct f2fs_lock_context *lc)
+static void restore_priority(struct f2fs_rwsem *sem, struct f2fs_lock_context *lc,
+ bool is_write)
{
if (!lc->need_restore)
return;
if (task_nice(current) != lc->new_nice)
return;
set_user_nice(current, lc->orig_nice);
+
+ trace_f2fs_priority_restore(sem->sbi, sem->name, is_write, current,
+ NICE_TO_PRIO(lc->orig_nice), NICE_TO_PRIO(lc->new_nice));
}
void f2fs_down_read_trace(struct f2fs_rwsem *sem, struct f2fs_lock_context *lc)
{
uplift_priority(sem, lc, false);
if (!f2fs_down_read_trylock(sem)) {
- restore_priority(lc);
+ restore_priority(sem, lc, false);
return 0;
}
trace_lock_elapsed_time_start(sem, lc);
void f2fs_up_read_trace(struct f2fs_rwsem *sem, struct f2fs_lock_context *lc)
{
f2fs_up_read(sem);
- restore_priority(lc);
+ restore_priority(sem, lc, false);
trace_lock_elapsed_time_end(sem, lc, false);
}
{
uplift_priority(sem, lc, true);
if (!f2fs_down_write_trylock(sem)) {
- restore_priority(lc);
+ restore_priority(sem, lc, true);
return 0;
}
trace_lock_elapsed_time_start(sem, lc);
void f2fs_up_write_trace(struct f2fs_rwsem *sem, struct f2fs_lock_context *lc)
{
f2fs_up_write(sem);
- restore_priority(lc);
+ restore_priority(sem, lc, true);
trace_lock_elapsed_time_end(sem, lc, true);
}
__entry->other_time)
);
+DECLARE_EVENT_CLASS(f2fs_priority_update,
+
+ TP_PROTO(struct f2fs_sb_info *sbi, enum f2fs_lock_name lock_name,
+ bool is_write, struct task_struct *p, int orig_prio,
+ int new_prio),
+
+ TP_ARGS(sbi, lock_name, is_write, p, orig_prio, new_prio),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __array(char, comm, TASK_COMM_LEN)
+ __field(pid_t, pid)
+ __field(unsigned int, lock_name)
+ __field(bool, is_write)
+ __field(int, orig_prio)
+ __field(int, new_prio)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = sbi->sb->s_dev;
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->lock_name = lock_name;
+ __entry->is_write = is_write;
+ __entry->orig_prio = orig_prio;
+ __entry->new_prio = new_prio;
+ ),
+
+ TP_printk("dev = (%d,%d), comm: %s, pid: %d, lock_name: %s, "
+ "lock_type: %s, orig_prio: %d, new_prio: %d",
+ show_dev(__entry->dev),
+ __entry->comm,
+ __entry->pid,
+ show_lock_name(__entry->lock_name),
+ __entry->is_write ? "wlock" : "rlock",
+ __entry->orig_prio,
+ __entry->new_prio)
+);
+
+DEFINE_EVENT(f2fs_priority_update, f2fs_priority_uplift,
+
+ TP_PROTO(struct f2fs_sb_info *sbi, enum f2fs_lock_name lock_name,
+ bool is_write, struct task_struct *p, int orig_prio,
+ int new_prio),
+
+ TP_ARGS(sbi, lock_name, is_write, p, orig_prio, new_prio)
+);
+
+DEFINE_EVENT(f2fs_priority_update, f2fs_priority_restore,
+
+ TP_PROTO(struct f2fs_sb_info *sbi, enum f2fs_lock_name lock_name,
+ bool is_write, struct task_struct *p, int orig_prio,
+ int new_prio),
+
+ TP_ARGS(sbi, lock_name, is_write, p, orig_prio, new_prio)
+);
+
#endif /* _TRACE_F2FS_H */
/* This part must be outside protection */