[RFC] [PATCH 08/13] Change pid accesses: mm/

From: Serge E. Hallyn
Date: Mon Nov 14 2005 - 16:33:33 EST


Replace-Subject: Change pid accesses: mm/
From: Serge Hallyn <serue@xxxxxxxxxx>

Change pid accesses for mm/.

Signed-off-by: Dave Hansen <haveblue@xxxxxxxxxx>
Signed-off-by: Serge Hallyn <serue@xxxxxxxxxx>
---
mm/nommu.c | 14 +++++++-------
mm/oom_kill.c | 10 +++++-----
2 files changed, 12 insertions(+), 12 deletions(-)

Index: linux-2.6.15-rc1/mm/nommu.c
===================================================================
--- linux-2.6.15-rc1.orig/mm/nommu.c
+++ linux-2.6.15-rc1/mm/nommu.c
@@ -264,7 +264,7 @@ static void show_process_blocks(void)
{
struct vm_list_struct *vml;

- printk("Process blocks %d:", current->pid);
+ printk("Process blocks %d:", task_pid(current));

for (vml = &current->mm->context.vmlist; vml; vml = vml->next) {
printk(" %p: %p", vml, vml->vma);
@@ -380,7 +380,7 @@ static int validate_mmap_request(struct
if (flags & MAP_FIXED || addr) {
printk(KERN_DEBUG
"%d: Can't do fixed-address/overlay mmap of RAM\n",
- current->pid);
+ task_pid(current));
return -EINVAL;
}

@@ -626,7 +626,7 @@ static int do_mmap_private(struct vm_are
#ifdef WARN_ON_SLACK
if (len + WARN_ON_SLACK <= kobjsize(result))
printk("Allocation of %lu bytes from process %d has %lu bytes of slack\n",
- len, current->pid, kobjsize(result) - len);
+ len, task_pid(current), kobjsize(result) - len);
#endif

if (vma->vm_file) {
@@ -663,7 +663,7 @@ error_free:

enomem:
printk("Allocation of length %lu from process %d failed\n",
- len, current->pid);
+ len, task_pid(current));
show_free_areas();
return -ENOMEM;
}
@@ -855,13 +855,13 @@ unsigned long do_mmap_pgoff(struct file
up_write(&nommu_vma_sem);
kfree(vml);
printk("Allocation of vma for %lu byte allocation from process %d failed\n",
- len, current->pid);
+ len, task_pid(current));
show_free_areas();
return -ENOMEM;

error_getting_vml:
printk("Allocation of vml for %lu byte allocation from process %d failed\n",
- len, current->pid);
+ len, task_pid(current));
show_free_areas();
return -ENOMEM;
}
@@ -915,7 +915,7 @@ int do_munmap(struct mm_struct *mm, unsi
goto found;

printk("munmap of non-mmaped memory by process %d (%s): %p\n",
- current->pid, current->comm, (void *) addr);
+ task_pid(current), current->comm, (void *) addr);
return -EINVAL;

found:
Index: linux-2.6.15-rc1/mm/oom_kill.c
===================================================================
--- linux-2.6.15-rc1.orig/mm/oom_kill.c
+++ linux-2.6.15-rc1/mm/oom_kill.c
@@ -125,7 +125,7 @@ unsigned long badness(struct task_struct

#ifdef DEBUG
printk(KERN_DEBUG "OOMkill: task %d (%s) got %d points\n",
- p->pid, p->comm, points);
+ task_pid(p), p->comm, points);
#endif
return points;
}
@@ -149,7 +149,7 @@ static struct task_struct * select_bad_p
int releasing;

/* skip the init task with pid == 1 */
- if (p->pid == 1)
+ if (task_pid(p) == 1)
continue;
if (p->oomkilladj == OOM_DISABLE)
continue;
@@ -184,7 +184,7 @@ static struct task_struct * select_bad_p
*/
static void __oom_kill_task(task_t *p)
{
- if (p->pid == 1) {
+ if (task_pid(p) == 1) {
WARN_ON(1);
printk(KERN_WARNING "tried to kill init!\n");
return;
@@ -199,7 +199,7 @@ static void __oom_kill_task(task_t *p)
}
task_unlock(p);
printk(KERN_ERR "Out of Memory: Killed process %d (%s).\n",
- p->pid, p->comm);
+ task_pid(p), p->comm);

/*
* We give our sacrificial lamb high priority and access to
@@ -230,7 +230,7 @@ static struct mm_struct *oom_kill_task(t
* but are in a different thread group
*/
do_each_thread(g, q)
- if (q->mm == mm && q->tgid != p->tgid)
+ if (q->mm == mm && task_tgid(q) != task_tgid(p))
__oom_kill_task(q);
while_each_thread(g, q);


--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/