Re: [PATCH 4/4] mvolatile: Add page purging logic & SIGBUS trap

From: John Stultz
Date: Wed Apr 16 2014 - 14:44:08 EST


On Sun, Apr 13, 2014 at 7:51 PM, Minchan Kim <minchan@xxxxxxxxxx> wrote:
> On Fri, Apr 11, 2014 at 01:15:40PM -0700, John Stultz wrote:
>> @@ -3643,6 +3644,8 @@ static int handle_pte_fault(struct mm_struct *mm,
>>
>> entry = *pte;
>> if (!pte_present(entry)) {
>> + swp_entry_t mvolatile_entry;
>> +
>> if (pte_none(entry)) {
>> if (vma->vm_ops) {
>> if (likely(vma->vm_ops->fault))
>> @@ -3652,6 +3655,11 @@ static int handle_pte_fault(struct mm_struct *mm,
>> return do_anonymous_page(mm, vma, address,
>> pte, pmd, flags);
>> }
>> +
>> + mvolatile_entry = pte_to_swp_entry(entry);
>> + if (unlikely(is_purged_entry(mvolatile_entry)))
>> + return VM_FAULT_SIGBUS;
>> +
>
> There is no pte lock so that is_purged_entry isn't safe so if race happens,
> do_swap_page could have a problem so it would be better to handle it
> do_swap_page with pte lock because we used swp_pte to indicate purged pte.
>
> I tried to solve it while we were in Napa(you could remember I sent
> crap patchset to you privately but failed to fix and I still didn't get
> a time to fix it :( ) but I'd like to inform this problem.

Thanks for the review and the reminder! I'll move the check appropriately.

thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/