[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4d14dcfc-0053-bfd6-433e-f264d22069d0@huawei.com>
Date: Wed, 20 Apr 2022 16:37:04 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: David Hildenbrand <david@...hat.com>,
Alistair Popple <apopple@...dia.com>
CC: <akpm@...ux-foundation.org>, <willy@...radead.org>,
<vbabka@...e.cz>, <dhowells@...hat.com>, <neilb@...e.de>,
<surenb@...gle.com>, <minchan@...nel.org>, <peterx@...hat.com>,
<sfr@...b.auug.org.au>, <rcampbell@...dia.com>,
<naoya.horiguchi@....com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] mm/swapfile: unuse_pte can map random data if swap
read fails
On 2022/4/20 15:07, David Hildenbrand wrote:
> On 20.04.22 08:15, Miaohe Lin wrote:
>> On 2022/4/20 8:25, Alistair Popple wrote:
>>> Miaohe Lin <linmiaohe@...wei.com> writes:
>>>
>>>> On 2022/4/19 15:53, Alistair Popple wrote:
>>>>> Also in madvise_free_pte_range() you could just remove the swap entry as it's no
>>>>> longer needed.
>>>>>
>>>>
>>>> This swap entry will be removed in madvise_dontneed_single_vma().
>>>> And in madvise_free_pte_range(), we may need to keep it as same as
>>>> hwpoison entry. Or am I supposed to remove it even if hwpoison entry
>>>> is reused later?
>>>
>>> Why would we need to keep it for MADV_FREE though? It only works on private
>>> anonymous memory, and once the MADV_FREE operation has succeeded callers can
>>> expect they might get zero-fill pages if accessing the memory again. Therefore
>>> it should be safe to delete the entry. I think that applies equally to a
>>> hwpoison entry too - there's no reason to kill the process if it has called
>>> MADV_FREE on the range.
>>
>> I tend to agree. We can drop the swapin error entry and hwpoison entry when MADV_FREE
>> is called. Should I squash these into the current patch or a separate one is preferred?
>>
>
> That should go into a separate patch.
Will do. Many thanks for your suggestion.
>
Powered by blists - more mailing lists