[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150522131822.74f374dd5a75a0285577c714@linux-foundation.org>
Date: Fri, 22 May 2015 13:18:22 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Andrea Arcangeli <aarcange@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
qemu-devel@...gnu.org, kvm@...r.kernel.org,
linux-api@...r.kernel.org, Pavel Emelyanov <xemul@...allels.com>,
Sanidhya Kashyap <sanidhya.gatech@...il.com>,
zhang.zhanghailiang@...wei.com,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Andres Lagar-Cavilla <andreslc@...gle.com>,
Dave Hansen <dave.hansen@...el.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Rik van Riel <riel@...hat.com>, Mel Gorman <mgorman@...e.de>,
Andy Lutomirski <luto@...capital.net>,
Hugh Dickins <hughd@...gle.com>,
Peter Feiner <pfeiner@...gle.com>,
"Dr. David Alan Gilbert" <dgilbert@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
"Huangpeng (Peter)" <peter.huangpeng@...wei.com>
Subject: Re: [PATCH 22/23] userfaultfd: avoid mmap_sem read recursion in
mcopy_atomic
On Thu, 14 May 2015 19:31:19 +0200 Andrea Arcangeli <aarcange@...hat.com> wrote:
> If the rwsem starves writers it wasn't strictly a bug but lockdep
> doesn't like it and this avoids depending on lowlevel implementation
> details of the lock.
>
> ...
>
> @@ -229,13 +246,33 @@ static __always_inline ssize_t __mcopy_atomic(struct mm_struct *dst_mm,
>
> if (!zeropage)
> err = mcopy_atomic_pte(dst_mm, dst_pmd, dst_vma,
> - dst_addr, src_addr);
> + dst_addr, src_addr, &page);
> else
> err = mfill_zeropage_pte(dst_mm, dst_pmd, dst_vma,
> dst_addr);
>
> cond_resched();
>
> + if (unlikely(err == -EFAULT)) {
> + void *page_kaddr;
> +
> + BUILD_BUG_ON(zeropage);
I'm not sure what this is trying to do. BUILD_BUG_ON(local_variable)?
It goes bang in my build. I'll just delete it.
> + up_read(&dst_mm->mmap_sem);
> + BUG_ON(!page);
> +
> + page_kaddr = kmap(page);
> + err = copy_from_user(page_kaddr,
> + (const void __user *) src_addr,
> + PAGE_SIZE);
> + kunmap(page);
> + if (unlikely(err)) {
> + err = -EFAULT;
> + goto out;
> + }
> + goto retry;
> + } else
> + BUG_ON(page);
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists