[PATCH 07/12] mempolicy: mpol_shared_policy_init() without pseudo-vma

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mpol_shared_policy_init() does not need to use a pseudo-vma: it can use
sp_alloc() and sp_insert() directly, since the object's shared policy
tree is empty and inaccessible (needing no lock) at get_inode() time.

Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
---
 mm/mempolicy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 065e886ec9b6..a22b641cfd6b 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2749,7 +2749,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
 	rwlock_init(&sp->lock);
 
 	if (mpol) {
-		struct vm_area_struct pvma;
+		struct sp_node *n;
 		struct mempolicy *new;
 		NODEMASK_SCRATCH(scratch);
 
@@ -2766,11 +2766,10 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
 		if (ret)
 			goto put_new;
 
-		/* Create pseudo-vma that contains just the policy */
-		vma_init(&pvma, NULL);
-		pvma.vm_end = TASK_SIZE;	/* policy covers entire file */
-		mpol_set_shared_policy(sp, &pvma, new); /* adds ref */
-
+		/* alloc node covering entire file; adds ref to new */
+		n = sp_alloc(0, MAX_LFS_FILESIZE >> PAGE_SHIFT, new);
+		if (n)
+			sp_insert(sp, n);
 put_new:
 		mpol_put(new);			/* drop initial ref */
 free_scratch:
-- 
2.35.3





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux