From: akpm@osdl.org
To: torvalds@osdl.org
Cc: linux-mm@kvack.org, akpm@osdl.org, hugh@veritas.com
Subject: [patch 44/57] rmap 28 remove_vm_struct
Date: Sat, 22 May 2004 15:11:41 -0700 [thread overview]
Message-ID: <200405222212.i4MMCBr14242@mail.osdl.org> (raw)
From: Hugh Dickins <hugh@veritas.com>
The callers of remove_shared_vm_struct then proceed to do several more
identical things: gather them together in remove_vm_struct.
---
25-akpm/mm/mmap.c | 31 +++++++++++--------------------
1 files changed, 11 insertions(+), 20 deletions(-)
diff -puN mm/mmap.c~rmap-28-remove_vm_struct mm/mmap.c
--- 25/mm/mmap.c~rmap-28-remove_vm_struct 2004-05-22 14:56:28.576747200 -0700
+++ 25-akpm/mm/mmap.c 2004-05-22 14:59:36.269213608 -0700
@@ -67,7 +67,7 @@ EXPORT_SYMBOL(vm_committed_space);
/*
* Requires inode->i_mapping->i_mmap_lock
*/
-static inline void __remove_shared_vm_struct(struct vm_area_struct *vma,
+static void __remove_shared_vm_struct(struct vm_area_struct *vma,
struct file *file, struct address_space *mapping)
{
if (vma->vm_flags & VM_DENYWRITE)
@@ -84,9 +84,9 @@ static inline void __remove_shared_vm_st
}
/*
- * Remove one vm structure from the inode's i_mapping address space.
+ * Remove one vm structure and free it.
*/
-static void remove_shared_vm_struct(struct vm_area_struct *vma)
+static void remove_vm_struct(struct vm_area_struct *vma)
{
struct file *file = vma->vm_file;
@@ -96,6 +96,12 @@ static void remove_shared_vm_struct(stru
__remove_shared_vm_struct(vma, file, mapping);
spin_unlock(&mapping->i_mmap_lock);
}
+ if (vma->vm_ops && vma->vm_ops->close)
+ vma->vm_ops->close(vma);
+ if (file)
+ fput(file);
+ mpol_free(vma_policy(vma));
+ kmem_cache_free(vm_area_cachep, vma);
}
/*
@@ -1165,14 +1171,7 @@ static void unmap_vma(struct mm_struct *
area->vm_start < area->vm_mm->free_area_cache)
area->vm_mm->free_area_cache = area->vm_start;
- remove_shared_vm_struct(area);
-
- mpol_free(vma_policy(area));
- if (area->vm_ops && area->vm_ops->close)
- area->vm_ops->close(area);
- if (area->vm_file)
- fput(area->vm_file);
- kmem_cache_free(vm_area_cachep, area);
+ remove_vm_struct(area);
}
/*
@@ -1501,15 +1500,7 @@ void exit_mmap(struct mm_struct *mm)
*/
while (vma) {
struct vm_area_struct *next = vma->vm_next;
- remove_shared_vm_struct(vma);
- if (vma->vm_ops) {
- if (vma->vm_ops->close)
- vma->vm_ops->close(vma);
- }
- if (vma->vm_file)
- fput(vma->vm_file);
- mpol_free(vma_policy(vma));
- kmem_cache_free(vm_area_cachep, vma);
+ remove_vm_struct(vma);
vma = next;
}
}
_
--
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>
reply other threads:[~2004-05-22 22:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200405222212.i4MMCBr14242@mail.osdl.org \
--to=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox