@@ -2736,30 +2736,30 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
2736
2736
rwlock_init (& sp -> lock );
2737
2737
2738
2738
if (mpol ) {
2739
- struct vm_area_struct pvma ;
2740
- struct mempolicy * new ;
2739
+ struct sp_node * sn ;
2740
+ struct mempolicy * npol ;
2741
2741
NODEMASK_SCRATCH (scratch );
2742
2742
2743
2743
if (!scratch )
2744
2744
goto put_mpol ;
2745
- /* contextualize the tmpfs mount point mempolicy */
2746
- new = mpol_new (mpol -> mode , mpol -> flags , & mpol -> w .user_nodemask );
2747
- if (IS_ERR (new ))
2745
+
2746
+ /* contextualize the tmpfs mount point mempolicy to this file */
2747
+ npol = mpol_new (mpol -> mode , mpol -> flags , & mpol -> w .user_nodemask );
2748
+ if (IS_ERR (npol ))
2748
2749
goto free_scratch ; /* no valid nodemask intersection */
2749
2750
2750
2751
task_lock (current );
2751
- ret = mpol_set_nodemask (new , & mpol -> w .user_nodemask , scratch );
2752
+ ret = mpol_set_nodemask (npol , & mpol -> w .user_nodemask , scratch );
2752
2753
task_unlock (current );
2753
2754
if (ret )
2754
- goto put_new ;
2755
-
2756
- /* Create pseudo-vma that contains just the policy */
2757
- vma_init (& pvma , NULL );
2758
- pvma .vm_end = TASK_SIZE ; /* policy covers entire file */
2759
- mpol_set_shared_policy (sp , & pvma , new ); /* adds ref */
2760
-
2761
- put_new :
2762
- mpol_put (new ); /* drop initial ref */
2755
+ goto put_npol ;
2756
+
2757
+ /* alloc node covering entire file; adds ref to file's npol */
2758
+ sn = sp_alloc (0 , MAX_LFS_FILESIZE >> PAGE_SHIFT , npol );
2759
+ if (sn )
2760
+ sp_insert (sp , sn );
2761
+ put_npol :
2762
+ mpol_put (npol ); /* drop initial ref on file's npol */
2763
2763
free_scratch :
2764
2764
NODEMASK_SCRATCH_FREE (scratch );
2765
2765
put_mpol :
0 commit comments