9 #include <linux/kernel.h>
11 #include <linux/sched.h>
13 #include <linux/types.h>
14 #include <asm/uaccess.h>
21 static int fpaff_threshold = -1;
53 match = (cred->
euid == pcred->euid ||
54 cred->
euid == pcred->uid);
63 unsigned long __user *user_mask_ptr)
70 if (len <
sizeof(new_mask))
79 p = find_process_by_pid(pid);
90 if (!alloc_cpumask_var(&cpus_allowed,
GFP_KERNEL)) {
94 if (!alloc_cpumask_var(&new_mask,
GFP_KERNEL)) {
96 goto out_free_cpus_allowed;
98 if (!alloc_cpumask_var(&effective_mask,
GFP_KERNEL)) {
100 goto out_free_new_mask;
111 cpumask_copy(&p->
thread.user_cpus_allowed, new_mask);
116 if (test_ti_thread_flag(ti, TIF_FPUBOUND) &&
118 cpus_and(*effective_mask, *new_mask, mt_fpu_cpumask);
119 retval = set_cpus_allowed_ptr(p, effective_mask);
121 cpumask_copy(effective_mask, new_mask);
122 clear_ti_thread_flag(ti, TIF_FPUBOUND);
123 retval = set_cpus_allowed_ptr(p, new_mask);
128 if (!cpumask_subset(effective_mask, cpus_allowed)) {
134 cpumask_copy(new_mask, cpus_allowed);
139 free_cpumask_var(effective_mask);
141 free_cpumask_var(new_mask);
142 out_free_cpus_allowed:
143 free_cpumask_var(cpus_allowed);
154 unsigned long __user *user_mask_ptr)
156 unsigned int real_len;
161 real_len =
sizeof(
mask);
169 p = find_process_by_pid(pid);
189 static int __init fpaff_thresh(
char *
str)
194 __setup(
"fpaff=", fpaff_thresh);
199 #define FPUSEFACTOR 2000
201 static __init int mt_fp_affinity_init(
void)
203 if (fpaff_threshold >= 0) {