linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hillf Danton <dhillf@gmail.com>
To: Hillf Danton <dhillf@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] mm: extend prefault helpers to fault in more than PAGE_SIZE
Date: Fri, 17 Feb 2012 21:06:17 +0800	[thread overview]
Message-ID: <CAJd=RBDFUZi3_tk2ZRpjF=5a9884zJGv4Ti_kM0pjXnRmw0jKA@mail.gmail.com> (raw)
In-Reply-To: <20120216151425.GB19158@phenom.ffwll.local>

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;

  reply	other threads:[~2012-02-17 13:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16 12:01 [PATCH] " Daniel Vetter
2012-02-16 12:01 ` [PATCH] mm: " Daniel Vetter
2012-02-16 13:32   ` Hillf Danton
2012-02-16 15:14     ` Daniel Vetter
2012-02-17 13:06       ` Hillf Danton [this message]
2012-02-23 22:36   ` Andrew Morton
2012-02-24 13:34     ` Daniel Vetter
2012-02-24 20:40       ` Andrew Morton
2012-02-29 14:03         ` Daniel Vetter
2012-02-29 23:01           ` Andrew Morton
2012-02-29 23:14             ` Daniel Vetter
2012-02-29 23:32               ` Andrew Morton
2012-03-01 19:22                 ` Daniel Vetter
2012-03-01 20:15                   ` Andrew Morton
2012-03-27 11:37                     ` Daniel Vetter
2012-04-13 19:12                   ` Geert Uytterhoeven
2012-04-14 16:03                     ` [PATCH] mm: fixup compilation error due to an asm write through a const pointer Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJd=RBDFUZi3_tk2ZRpjF=5a9884zJGv4Ti_kM0pjXnRmw0jKA@mail.gmail.com' \
    --to=dhillf@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox