Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

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

 



Daniel Jordan <daniel.m.jordan@xxxxxxxxxx> writes:

> On Tue, Nov 16, 2021 at 12:12:37PM +0530, Aneesh Kumar K.V wrote:
>> sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,
>> 				  home_node, 0);
>
> What about sys_mbind_home_node so the name is better aligned with mbind,
> since both operate on vma policy?  The syscall might or might not be
> extended to task memory policy, but vma policy is what we're using this
> for today.

I used the name set_mempolicy_home_node, because we are setting the home
for a memory policy. I find the term mbind confusing. 

>
>
>> +SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
>> +		unsigned long, home_node, unsigned long, flags)
>
> mbind does untagged_addr(addr), why doesn't this need to do the same?
> Seems like tagged addresses could be passed here too.
>

updated
modified   mm/mempolicy.c
@@ -1489,6 +1489,7 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
 	unsigned long end;
 	int err = -ENOENT;
 
+	start = untagged_addr(start);
 	if (start & ~PAGE_MASK)
 		return -EINVAL;
 	/*



>
>> +		/*
>> +		 * Only update home node if there is an existing vma policy
>> +		 */
>> +		if (!new)
>> +			continue;
>> +		new->home_node = home_node;
>> +		err = mbind_range(mm, vmstart, vmend, new);
>
> I think you need an mpol_put(new) here since @new is dup'ed again during
> mbind_range > vma_replace_policy.

updated
@@ -1536,6 +1540,7 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
 
 		new->home_node = home_node;
 		err = mbind_range(mm, vmstart, vmend, new);
+		mpol_put(new);
 		if (err)
 			break;
 	}


Thanks for your review
-aneesh



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux