Re: [PATCH] mm: madvise: return correct bytes advised with process_madvise

From: Charan Teja Kalla
Date: Thu Mar 10 2022 - 03:25:41 EST



Thanks Minchan for your comment!!
On 3/9/2022 10:17 PM, Minchan Kim wrote:
>> @@ -1426,15 +1426,21 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec,
>>
>> while (iov_iter_count(&iter)) {
>> iovec = iov_iter_iovec(&iter);
>> + /*
>> + * Even when [start, end) passed to do_madvise covers
>> + * some unmapped addresses, it continues processing with
>> + * returning ENOMEM at the end. Thus consider the range
>> + * as processed when do_madvise() returns ENOMEM.
>> + * This makes process_madvise() never returns ENOMEM.
>> + */
> Looks like that this patch has two things. first, returns processed
> bytes instead of error in case of error. Second, keep working on
> rest vmas on -ENOMEM due to unmapped hole.
>
> First thing totally makes sense to me(that's exactly I wanted to
> do but somehow missed) so it should go stable tree. However,
> second stuff might be arguble so it would be great if you split
> the patch.

Sure, then will split the patch in V2.

>