Remove a no longer needed test for NULL cpuset pointer, with a little comment explaining why the test isn't needed.
Unified · Split
| @@ -2023,7 +2023,7 @@ void cpuset_fork(struct task_struct *child) · 2022 unmodified lines | ||
| 2023 | 2023 | * because tsk is already marked PF_EXITING, so attach_task() won't |
| 2024 | 2024 | * mess with it, or task is a failed fork, never visible to attach_task. |
| 2025 | 2025 | * |
| 2026 | − * Hack: | |
| 2026 | + * the_top_cpuset_hack: | |
| 2027 | 2027 | * |
| 2028 | 2028 | * Set the exiting tasks cpuset to the root cpuset (top_cpuset). |
| 2029 | 2029 | * |
| @@ -2062,7 +2062,7 @@ void cpuset_exit(struct task_struct *tsk) · 32 unmodified lines | ||
| 2062 | 2062 | struct cpuset *cs; |
| 2063 | 2063 | |
| 2064 | 2064 | cs = tsk->cpuset; |
| 2065 | − tsk->cpuset = &top_cpuset; /* Hack - see comment above */ | |
| 2065 | + tsk->cpuset = &top_cpuset; /* the_top_cpuset_hack - see above */ | |
| 2066 | 2066 | |
| 2067 | 2067 | if (notify_on_release(cs)) { |
| 2068 | 2068 | char *pathbuf = NULL; |
| @@ -2373,12 +2373,12 @@ void __cpuset_memory_pressure_bump(void) · 304 unmodified lines | ||
| 2373 | 2373 | * - No need to task_lock(tsk) on this tsk->cpuset reference, as it |
| 2374 | 2374 | * doesn't really matter if tsk->cpuset changes after we read it, |
| 2375 | 2375 | * and we take manage_mutex, keeping attach_task() from changing it |
| 2376 | − * anyway. | |
| 2376 | + * anyway. No need to check that tsk->cpuset != NULL, thanks to | |
| 2377 | + * the_top_cpuset_hack in cpuset_exit(), which sets an exiting tasks | |
| 2378 | + * cpuset to top_cpuset. | |
| 2377 | 2379 | */ |
| 2378 | − | |
| 2379 | 2380 | static int proc_cpuset_show(struct seq_file *m, void *v) |
| 2380 | 2381 | { |
| 2381 | − struct cpuset *cs; | |
| 2382 | 2382 | struct task_struct *tsk; |
| 2383 | 2383 | char *buf; |
| 2384 | 2384 | int retval = 0; |
| @@ -2389,13 +2389,7 @@ static int proc_cpuset_show(struct seq_file *m, void *v) · 4 unmodified lines | ||
| 2389 | 2389 | |
| 2390 | 2390 | tsk = m->private; |
| 2391 | 2391 | mutex_lock(&manage_mutex); |
| 2392 | − cs = tsk->cpuset; | |
| 2393 | − if (!cs) { | |
| 2394 | − retval = -EINVAL; | |
| 2395 | − goto out; | |
| 2396 | − } | |
| 2397 | − | |
| 2398 | − retval = cpuset_path(cs, buf, PAGE_SIZE); | |
| 2392 | + retval = cpuset_path(tsk->cpuset, buf, PAGE_SIZE); | |
| 2399 | 2393 | if (retval < 0) |
| 2400 | 2394 | goto out; |
| 2401 | 2395 | seq_puts(m, buf); |