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
20232023 * because tsk is already marked PF_EXITING, so attach_task() won't
20242024 * mess with it, or task is a failed fork, never visible to attach_task.
20252025 *
2026− * Hack:
2026+ * the_top_cpuset_hack:
20272027 *
20282028 * Set the exiting tasks cpuset to the root cpuset (top_cpuset).
20292029 *
@@ -2062,7 +2062,7 @@ void cpuset_exit(struct task_struct *tsk) · 32 unmodified lines
20622062 struct cpuset *cs;
20632063
20642064 cs = tsk->cpuset;
2065− tsk->cpuset = &top_cpuset; /* Hack - see comment above */
2065+ tsk->cpuset = &top_cpuset; /* the_top_cpuset_hack - see above */
20662066
20672067 if (notify_on_release(cs)) {
20682068 char *pathbuf = NULL;
@@ -2373,12 +2373,12 @@ void __cpuset_memory_pressure_bump(void) · 304 unmodified lines
23732373 * - No need to task_lock(tsk) on this tsk->cpuset reference, as it
23742374 * doesn't really matter if tsk->cpuset changes after we read it,
23752375 * 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.
23772379 */
2378−
23792380 static int proc_cpuset_show(struct seq_file *m, void *v)
23802381 {
2381− struct cpuset *cs;
23822382 struct task_struct *tsk;
23832383 char *buf;
23842384 int retval = 0;
@@ -2389,13 +2389,7 @@ static int proc_cpuset_show(struct seq_file *m, void *v) · 4 unmodified lines
23892389
23902390 tsk = m->private;
23912391 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);
23992393 if (retval < 0)
24002394 goto out;
24012395 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