History

[PATCH] cpuset: remove unnecessary NULL check

Remove a no longer needed test for NULL cpuset pointer, with a little comment explaining why the test isn't needed.

Paul Jackson committed 20 years ago

Commit 8488bc31 parent b0196001 file · +6 −12Browse files

Unified · Split

kernel/cpuset.c+6−12
@@ -2023,7 +2023,7 @@ void cpuset_fork(struct task_struct *child) · 2022 unmodified lines
2023 * because tsk is already marked PF_EXITING, so attach_task() won't2023 * because tsk is already marked PF_EXITING, so attach_task() won't
2024 * mess with it, or task is a failed fork, never visible to attach_task.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 * Set the exiting tasks cpuset to the root cpuset (top_cpuset).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 struct cpuset *cs;2062 struct cpuset *cs;
2063 2063
2064 cs = tsk->cpuset;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 if (notify_on_release(cs)) {2067 if (notify_on_release(cs)) {
2068 char *pathbuf = NULL;2068 char *pathbuf = NULL;
@@ -2373,12 +2373,12 @@ void __cpuset_memory_pressure_bump(void) · 304 unmodified lines
2373 * - No need to task_lock(tsk) on this tsk->cpuset reference, as it2373 * - No need to task_lock(tsk) on this tsk->cpuset reference, as it
2374 * doesn't really matter if tsk->cpuset changes after we read it,2374 * doesn't really matter if tsk->cpuset changes after we read it,
2375 * and we take manage_mutex, keeping attach_task() from changing it2375 * 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
2379static int proc_cpuset_show(struct seq_file *m, void *v)2380static int proc_cpuset_show(struct seq_file *m, void *v)
2380{2381{
2381 struct cpuset *cs;
2382 struct task_struct *tsk;2382 struct task_struct *tsk;
2383 char *buf;2383 char *buf;
2384 int retval = 0;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 tsk = m->private;2390 tsk = m->private;
2391 mutex_lock(&manage_mutex);2391 mutex_lock(&manage_mutex);
2392 cs = tsk->cpuset;2392 retval = cpuset_path(tsk->cpuset, buf, PAGE_SIZE);
2393 if (!cs) {
2394 retval = -EINVAL;
2395 goto out;
2396 }
2397
2398 retval = cpuset_path(cs, buf, PAGE_SIZE);
2399 if (retval < 0)2393 if (retval < 0)
2400 goto out;2394 goto out;
2401 seq_puts(m, buf);2395 seq_puts(m, buf);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t