From: Greg Ungerer <gerg@snapgear.com>
To: Bob Liu <lliubbo@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, dhowells@redhat.com, lethal@linux-sh.org,
gerg@uclinux.org, walken@google.com, daniel-gl@gmx.net,
vapier@gentoo.org, Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH] nommu: add page_align to mmap
Date: Fri, 6 May 2011 10:32:05 +1000 [thread overview]
Message-ID: <4DC34185.4040106@snapgear.com> (raw)
In-Reply-To: <BANLkTimB+ZnvH2BdP5m=VypDnYKNbnmZVQ@mail.gmail.com>
Hi Bob,
On 05/05/11 20:19, Bob Liu wrote:
> On Thu, May 5, 2011 at 9:38 AM, Greg Ungerer<gerg@snapgear.com> wrote:
>> On 05/05/11 07:13, Andrew Morton wrote:
>>>
>>> On Wed, 27 Apr 2011 15:12:14 +0800
>>> Bob Liu<lliubbo@gmail.com> áwrote:
>>>
>>>> Currently on nommu arch mmap(),mremap() and munmap() doesn't do
>>>> page_align()
>>>> which is incorrect and not consist with mmu arch.
>>>> This patch fix it.
>>>>
>>>
>>> Can you explain this fully please? áWhat was the user-observeable
>>> behaviour before the patch, and after?
>>>
>>> And some input from nommu maintainers would be nice.
>>
>> Its not obvious to me that there is a problem here. Are there
>> any issues caused by the current behavior that this fixes?
>>
>
> Yes, there is a issue.
>
> Some drivers' mmap() function depend on (vma->vm_end - vma->start) is
> page aligned which is true on mmu arch but not on nommu.
> eg: uvc camera driver.
>
> What's more, sometimes I got munmap() error.
> The reason is split file: mm/nommu.c
> do {
> 1614 if (start> vma->vm_start) {
> 1615 kleave(" = -EINVAL [miss]");
> 1616 return -EINVAL;
> 1617 }
> 1618 if (end == vma->vm_end)
> 1619 goto erase_whole_vma;
>
> <<=====================here
> 1620 rb = rb_next(&vma->vm_rb);
> 1621 vma = rb_entry(rb, struct vm_area_struct, vm_rb);
> 1622 } while (rb);
> 1623 kleave(" = -EINVAL [split file]");
>
> Because end is not page aligned (passed into from userspace) while
> some unknown reason
> vma->vm_end is aligned, this loop will fail and -EINVAL[split file]
> error returned.
> But it's hard to reproduce.
>
> And in my opinion consist with mmu alway a better choice.
>
> Thanks for your review.
Ok, makes sense. Can you add some of this writeup to the patch
commit message?
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2011-05-06 0:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-27 7:12 [PATCH] nommu: add page_align to mmap Bob Liu
2011-05-04 21:13 ` Andrew Morton
2011-05-05 1:38 ` Greg Ungerer
2011-05-05 10:19 ` Bob Liu
2011-05-06 0:32 ` Greg Ungerer [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=4DC34185.4040106@snapgear.com \
--to=gerg@snapgear.com \
--cc=akpm@linux-foundation.org \
--cc=daniel-gl@gmx.net \
--cc=dhowells@redhat.com \
--cc=geert@linux-m68k.org \
--cc=gerg@uclinux.org \
--cc=lethal@linux-sh.org \
--cc=linux-mm@kvack.org \
--cc=lliubbo@gmail.com \
--cc=vapier@gentoo.org \
--cc=walken@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.