From: Mike Frysinger <vapier.adi@gmail.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-kernel@vger.kernel.org,
uclinux-dist-devel@blackfin.uclinux.org,
Bernd Schmidt <bernds_cb1@t-online.de>,
Bryan Wu <cooloney@kernel.org>,
David Howells <dhowells@redhat.com>
Subject: Re: [PATCH] NOMMU: add support for Memory Protection Units (MPU)
Date: Tue, 14 Jul 2009 12:19:04 -0400 [thread overview]
Message-ID: <8bd0f97a0907140919j645d03c3nac348d2106b63bef@mail.gmail.com> (raw)
In-Reply-To: <20090714161416.GA19147@cmpxchg.org>
On Tue, Jul 14, 2009 at 12:14, Johannes Weiner wrote:
> On Tue, Jul 14, 2009 at 10:22:20AM -0400, Mike Frysinger wrote:
>> --- a/mm/nommu.c
>> +++ b/mm/nommu.c
>> @@ -640,11 +641,23 @@ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
>> struct vm_area_struct *pvma, **pp;
>> struct address_space *mapping;
>> struct rb_node **p, *parent;
>> +#ifdef CONFIG_MPU
>> + long start;
>> +#endif
>>
>> kenter(",%p", vma);
>>
>> BUG_ON(!vma->vm_region);
>>
>> +#ifdef CONFIG_MPU
>> + start = vma->vm_start & PAGE_MASK;
>> + while (start < vma->vm_end) {
>> + protect_page(mm, start, vma->vm_flags);
>> + start += PAGE_SIZE;
>> + }
>> + update_protections(mm);
>> +#endif
>> +
>> mm->map_count++;
>> vma->vm_mm = mm;
>>
>> @@ -707,9 +720,21 @@ static void delete_vma_from_mm(struct vm_area_struct *vma)
>> struct vm_area_struct **pp;
>> struct address_space *mapping;
>> struct mm_struct *mm = vma->vm_mm;
>> +#ifdef CONFIG_MPU
>> + long start;
>> +#endif
>>
>> kenter("%p", vma);
>>
>> +#ifdef CONFIG_MPU
>> + start = vma->vm_start & PAGE_MASK;
>> + while (start < vma->vm_end) {
>> + protect_page(mm, start, 0);
>> + start += PAGE_SIZE;
>> + }
>> + update_protections(mm);
>> +#endif
>
> How about refactoring that into one function? Saves all but one
> #ifdef.
makes sense to me, thanks
-mike
next prev parent reply other threads:[~2009-07-14 16:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 14:22 Mike Frysinger
2009-07-14 16:14 ` Johannes Weiner
2009-07-14 16:19 ` Mike Frysinger [this message]
2009-07-14 17:14 ` [PATCH v2] " Mike Frysinger
2009-09-14 3:52 ` Mike Frysinger
2009-09-16 10:09 ` David Howells
2009-07-14 17:22 ` David Howells
2009-07-14 21:59 ` Bernd Schmidt
2009-07-15 9:24 ` Paul Mundt
2009-07-15 10:31 ` David Howells
2009-07-15 11:18 ` [Uclinux-dist-devel] " Mike Frysinger
2009-07-15 10:37 ` David Howells
2009-07-15 11:12 ` [Uclinux-dist-devel] " Mike Frysinger
2009-07-15 11:45 ` David Howells
2009-07-15 11:55 ` Mike Frysinger
2009-07-15 12:25 ` David Howells
2009-07-15 12:52 ` Mike Frysinger
2009-09-16 13:57 ` [PATCH] " Mike Frysinger
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=8bd0f97a0907140919j645d03c3nac348d2106b63bef@mail.gmail.com \
--to=vapier.adi@gmail.com \
--cc=bernds_cb1@t-online.de \
--cc=cooloney@kernel.org \
--cc=dhowells@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=uclinux-dist-devel@blackfin.uclinux.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
all inboxes | Powered by JetHome®