On Fri, Jul 11, 2025 at 05:37:54PM +0200, David Hildenbrand wrote:
>> diff --git a/tools/testing/selftests/mm/vm_util.c 
>> b/tools/testing/selftests/mm/vm_util.c
>> index 1357e2d6a7b6..115422e9eb68 100644
>> --- a/tools/testing/selftests/mm/vm_util.c
>> +++ b/tools/testing/selftests/mm/vm_util.c
>> @@ -486,3 +486,74 @@ int close_procmap(struct procmap_fd *procmap)
>>   {
>>      return close(procmap->fd);
>>   }
>> +
>
>I think we should just let all these functions open/close the fds. So there
>will not be a need to pass in the fds.
>

Sure. Will update it.

>> +int ksm_use_zero_pages(int ksm_use_zero_pages_fd)
>> +{
>> +    return write(ksm_use_zero_pages_fd, "1", 1);
>> +}
>> +
>> +int ksm_start_and_merge(int ksm_fd)
>> +{
>> +    return write(ksm_fd, "1", 1);
>> +}> +
>> +int ksm_stop_and_unmerge(int ksm_fd)
>> +{
>> +    return write(ksm_fd, "2", 1);
>> +}
>
>Can we make all these functions return "0" on success? This, way, the "write"
>will be an internal implementation detail.
>
>E.g.,
>
>int ksm_stop_and_unmerge(void)
>{
>       int ksm_fd = ...
>       ssize_t ret;
>
>       ...
>
>       ret = write(ksm_fd, "2", 1);
>       close(ksm_fd);
>       return ret == 1 ? 0 : ret;
>}
>

Sure will do it.


-- 
Wei Yang
Help you, Help me

Reply via email to