Thread (8 messages) 8 messages, 2 authors, 2003-08-14

Re: [PATCH] Deprecate /proc/#/statm

From: Roger Luethi <hidden>
Date: 2003-08-13 07:58:14

On Tue, 12 Aug 2003 17:36:20 -0700, William Lee Irwin III wrote:
Best to just delete the code instead of the #if 0
Like this?

Roger

diff -ur linux-2.5.orig/fs/proc/array.c linux-2.5/fs/proc/array.c
--- linux-2.5.orig/fs/proc/array.c	2003-08-13 09:50:15.485989476 +0200
+++ linux-2.5/fs/proc/array.c	2003-08-13 09:45:03.646004248 +0200
@@ -388,19 +388,10 @@
 	return res;
 }
 
-extern int task_statm(struct mm_struct *, int *, int *, int *, int *);
 int proc_pid_statm(struct task_struct *task, char *buffer)
 {
 	int size = 0, resident = 0, shared = 0, text = 0, lib = 0, data = 0;
-	struct mm_struct *mm = get_task_mm(task);
-	
-	if (mm) {
-		down_read(&mm->mmap_sem);
-		size = task_statm(mm, &shared, &text, &data, &resident);
-		up_read(&mm->mmap_sem);
-
-		mmput(mm);
-	}
+	/* TODO Rip /proc/#/statm out in 2.7 */
 
 	return sprintf(buffer,"%d %d %d %d %d %d %d\n",
 		       size, resident, shared, text, lib, data, 0);
diff -ur linux-2.5.orig/fs/proc/task_mmu.c linux-2.5/fs/proc/task_mmu.c
--- linux-2.5.orig/fs/proc/task_mmu.c	2003-08-13 09:45:57.507057766 +0200
+++ linux-2.5/fs/proc/task_mmu.c	2003-08-13 09:41:41.844772701 +0200
@@ -48,33 +48,6 @@
 	return PAGE_SIZE * mm->total_vm;
 }
 
-int task_statm(struct mm_struct *mm, int *shared, int *text,
-	       int *data, int *resident)
-{
-	struct vm_area_struct *vma;
-	int size = 0;
-
-	*resident = mm->rss;
-	for (vma = mm->mmap; vma; vma = vma->vm_next) {
-		int pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
-
-		size += pages;
-		if (is_vm_hugetlb_page(vma)) {
-			if (!(vma->vm_flags & VM_DONTCOPY))
-				*shared += pages;
-			continue;
-		}
-		if (vma->vm_flags & VM_SHARED || !list_empty(&vma->shared))
-			*shared += pages;
-		if (vma->vm_flags & VM_EXECUTABLE)
-			*text += pages;
-		else
-			*data += pages;
-	}
-
-	return size;
-}
-
 static int show_map(struct seq_file *m, void *v)
 {
 	struct vm_area_struct *map = v;
diff -ur linux-2.5.orig/fs/proc/task_nommu.c linux-2.5/fs/proc/task_nommu.c
--- linux-2.5.orig/fs/proc/task_nommu.c	2003-08-13 09:45:57.509057471 +0200
+++ linux-2.5/fs/proc/task_nommu.c	2003-08-13 09:42:06.212178570 +0200
@@ -75,28 +75,6 @@
 	return vsize;
 }
 
-int task_statm(struct mm_struct *mm, int *shared, int *text,
-	       int *data, int *resident)
-{
-	struct mm_tblock_struct *tbp;
-	int size = kobjsize(mm);
-	
-	for (tbp = &mm->context.tblock; tbp; tbp = tbp->next) {
-		if (tbp->next)
-			size += kobjsize(tbp->next);
-		if (tbp->rblock) {
-			size += kobjsize(tbp->rblock);
-			size += kobjsize(tbp->rblock->kblock);
-		}
-	}
-
-	size += (*text = mm->end_code - mm->start_code);
-	size += (*data = mm->start_stack - mm->start_data);
-
-	*resident = size;
-	return size;
-}
-
 /*
  * Albert D. Cahalan suggested to fake entries for the traditional
  * sections here.  This might be worth investigating.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help