Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751984Ab2BQNGT (ORCPT ); Fri, 17 Feb 2012 08:06:19 -0500 Received: from mail-vw0-f46.google.com ([209.85.212.46]:48540 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464Ab2BQNGS (ORCPT ); Fri, 17 Feb 2012 08:06:18 -0500 MIME-Version: 1.0 In-Reply-To: <20120216151425.GB19158@phenom.ffwll.local> References: <1329393696-4802-1-git-send-email-daniel.vetter@ffwll.ch> <1329393696-4802-2-git-send-email-daniel.vetter@ffwll.ch> <20120216151425.GB19158@phenom.ffwll.local> Date: Fri, 17 Feb 2012 21:06:17 +0800 Message-ID: Subject: Re: [PATCH] mm: extend prefault helpers to fault in more than PAGE_SIZE From: Hillf Danton To: Hillf Danton , Andrew Morton , Intel Graphics Development , DRI Development , LKML , Linux MM Cc: Daniel Vetter Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id q1HD6UGj032126 Content-Length: 1937 Lines: 41 On Thu, Feb 16, 2012 at 11:14 PM, Daniel Vetter wrote: > On Thu, Feb 16, 2012 at 09:32:08PM +0800, Hillf Danton wrote: >> On Thu, Feb 16, 2012 at 8:01 PM, Daniel Vetter wrote: >> > @@ -416,17 +417,20 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size) >> >         * Writing zeroes into userspace here is OK, because we know that if >> >         * the zero gets there, we'll be overwriting it. >> >         */ >> > -       ret = __put_user(0, uaddr); >> > +       while (uaddr <= end) { >> > +               ret = __put_user(0, uaddr); >> > +               if (ret != 0) >> > +                       return ret; >> > +               uaddr += PAGE_SIZE; >> > +       } >> >> What if >>              uaddr & ~PAGE_MASK == PAGE_SIZE -3 && >>                 end & ~PAGE_MASK == 2 > > I don't quite follow - can you elaborate upon which issue you're seeing? I concerned that __put_user(0, end) is missed, but it was added below. And looks good to me. Hillf >        if (ret == 0) { > -               char __user *end = uaddr + size - 1; > - >                /* >                 * If the page was already mapped, this will get a cache miss >                 * for sure, so try to avoid doing it. >                 */ > -               if (((unsigned long)uaddr & PAGE_MASK) != > +               if (((unsigned long)uaddr & PAGE_MASK) == >                                ((unsigned long)end & PAGE_MASK)) > -                       ret = __put_user(0, end); > +                       ret = __put_user(0, end); >        } >        return ret; ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?