#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
+#include <linux/rtmutex.h>
#define UID_HASH_BITS 10
DECLARE_HASHTABLE(hash_table, UID_HASH_BITS);
-static DEFINE_MUTEX(uid_lock);
+static DEFINE_RT_MUTEX(uid_lock);
static struct proc_dir_entry *cpu_parent;
static struct proc_dir_entry *io_parent;
static struct proc_dir_entry *proc_parent;
cputime_t stime;
unsigned long bkt;
- mutex_lock(&uid_lock);
+ rt_mutex_lock(&uid_lock);
hash_for_each(hash_table, bkt, uid_entry, hash) {
uid_entry->active_stime = 0;
current_user_ns(), task_uid(task)));
if (!uid_entry) {
read_unlock(&tasklist_lock);
- mutex_unlock(&uid_lock);
+ rt_mutex_unlock(&uid_lock);
pr_err("%s: failed to find the uid_entry for uid %d\n",
__func__, from_kuid_munged(current_user_ns(),
task_uid(task)));
total_power);
}
- mutex_unlock(&uid_lock);
+ rt_mutex_unlock(&uid_lock);
return 0;
}
kstrtol(end_uid, 10, &uid_end) != 0) {
return -EINVAL;
}
- mutex_lock(&uid_lock);
+ rt_mutex_lock(&uid_lock);
for (; uid_start <= uid_end; uid_start++) {
hash_for_each_possible_safe(hash_table, uid_entry, tmp,
}
}
- mutex_unlock(&uid_lock);
+ rt_mutex_unlock(&uid_lock);
return count;
}
struct io_stats *io_bucket, *io_curr, *io_last;
unsigned long bkt;
- BUG_ON(!mutex_is_locked(&uid_lock));
+ BUG_ON(!rt_mutex_is_locked(&uid_lock));
hash_for_each(hash_table, bkt, uid_entry, hash)
memset(&uid_entry->io[UID_STATE_TOTAL_CURR], 0,
struct uid_entry *uid_entry;
unsigned long bkt;
- mutex_lock(&uid_lock);
+ rt_mutex_lock(&uid_lock);
update_io_stats_locked();
uid_entry->io[UID_STATE_BACKGROUND].fsync);
}
- mutex_unlock(&uid_lock);
+ rt_mutex_unlock(&uid_lock);
return 0;
}
if (state != UID_STATE_BACKGROUND && state != UID_STATE_FOREGROUND)
return -EINVAL;
- mutex_lock(&uid_lock);
+ rt_mutex_lock(&uid_lock);
uid_entry = find_or_register_uid(uid);
if (!uid_entry) {
- mutex_unlock(&uid_lock);
+ rt_mutex_unlock(&uid_lock);
return -EINVAL;
}
if (uid_entry->state == state) {
- mutex_unlock(&uid_lock);
+ rt_mutex_unlock(&uid_lock);
return count;
}
uid_entry->state = state;
- mutex_unlock(&uid_lock);
+ rt_mutex_unlock(&uid_lock);
return count;
}
if (!task)
return NOTIFY_OK;
- mutex_lock(&uid_lock);
+ rt_mutex_lock(&uid_lock);
uid = from_kuid_munged(current_user_ns(), task_uid(task));
uid_entry = find_or_register_uid(uid);
if (!uid_entry) {
clean_uid_io_last_stats(uid_entry, task);
exit:
- mutex_unlock(&uid_lock);
+ rt_mutex_unlock(&uid_lock);
return NOTIFY_OK;
}