> On Jul 29, 2019, at 8:05 AM, Oleg Nesterov <o...@redhat.com> wrote:
>
> I didn't see this version, so let me reply here.
>
> On 07/26, Andrew Morton wrote:
>>
>> + /* try orig_page only for unregister and anonymous old_page */
>> + if (!is_register && PageAnon(old_page)) {
>
> Well, this is confusing... nothing really wrong, but we certainly do not
> want to install the new anonymous page if !is_register && !PageAnon(old).
> And in this case we do not even want to call __replace page().
>
> OK, I won't insist, this should almost never happen, but again, please
> see https://lore.kernel.org/lkml/20190726084423.ga16...@redhat.com/
I see. Do you want me fold this patch with 2/4?
>
>> + struct page *orig_page;
>> + pgoff_t index;
>> +
>> + index = vaddr_to_offset(vma, vaddr & PAGE_MASK) >> PAGE_SHIFT;
>> + orig_page = find_get_page(vma->vm_file->f_inode->i_mapping,
>> + index);
>> +
>> + if (orig_page) {
>> + if (PageUptodate(orig_page) &&
>> + pages_identical(new_page, orig_page)) {
>> + /* let go new_page */
>> + put_page(new_page);
>> + new_page = NULL;
>> +
>> + /* dec_mm_counter for old_page */
>> + dec_mm_counter(mm, MM_ANONPAGES);
>
> this assumes that __replace_page() can't fail, but it can. I think you
> should move this into into __replace_page().
Good catch! Let me fix it.
Hi Andrew,
Do you prefer a whole v10 (1/4 to 4/4) or just newer version of this
one (2/4)?
Thanks,
Song