linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jun'ichi Nomura <j-nomura@ce.jp.nec.com>,
	Matt Mackall <mpm@selenic.com>
Subject: Re: [BUGFIX][PATCH] pagemap: set pagemap walk limit to PMD boundary
Date: Mon, 22 Nov 2010 13:09:54 +0900	[thread overview]
Message-ID: <20101122040953.GB3017@spritzera.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20101122120102.e0e76373.kamezawa.hiroyu@jp.fujitsu.com>

> > @@ -776,7 +777,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
> >  		unsigned long end;
> >
> >  		pm.pos = 0;
> > -		end = start_vaddr + PAGEMAP_WALK_SIZE;
> > +		end = (start_vaddr + PAGEMAP_WALK_SIZE) & PAGEMAP_WALK_MASK;
> >  		/* overflow ? */
> >  		if (end < start_vaddr || end > end_vaddr)
> >  			end = end_vaddr;
>
> Ack.
>
> But ALIGN() can't be used ?

ALIGN() returns the same address as the input if it is already aligned,
but what we need here is the next PMD boundary. So something like

                end = IS_ALIGNED(start_vaddr, PAGEMAP_WALK_SIZE) ?
                        start_vaddr + PAGEMAP_WALK_SIZE :
                        ALIGN(start_vaddr, PAGEMAP_WALK_SIZE)          

keeps the semantics, but I don't like it because it's lengthy.

Anyway, thanks for your comment.

Naoya Horiguchi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2010-11-22  4:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19  9:07 Naoya Horiguchi
2010-11-22  3:01 ` KAMEZAWA Hiroyuki
2010-11-22  4:09   ` Naoya Horiguchi [this message]

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=20101122040953.GB3017@spritzera.linux.bs1.fc.nec.co.jp \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    /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