From: Bob Liu <lliubbo@gmail.com>
To: Greg Ungerer <gerg@snapgear.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: Thu, 5 May 2011 18:19:56 +0800 [thread overview]
Message-ID: <BANLkTimB+ZnvH2BdP5m=VypDnYKNbnmZVQ@mail.gmail.com> (raw)
In-Reply-To: <4DC1FFA5.1090207@snapgear.com>
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.
--
Regards,
--Bob
--
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>
next prev parent reply other threads:[~2011-05-05 10:19 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 [this message]
2011-05-06 0:32 ` Greg Ungerer
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='BANLkTimB+ZnvH2BdP5m=VypDnYKNbnmZVQ@mail.gmail.com' \
--to=lliubbo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=daniel-gl@gmx.net \
--cc=dhowells@redhat.com \
--cc=geert@linux-m68k.org \
--cc=gerg@snapgear.com \
--cc=gerg@uclinux.org \
--cc=lethal@linux-sh.org \
--cc=linux-mm@kvack.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).