lkml.org 
[lkml]   [2012]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH] mm: extend prefault helpers to fault in more than PAGE_SIZE
    From
    On Thu, Feb 16, 2012 at 11:14 PM, Daniel Vetter <daniel@ffwll.ch> 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 <daniel.vetter@ffwll.ch> 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;
    \
     
     \ /
      Last update: 2012-02-17 14:09    [W:0.030 / U:32.956 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site