[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8bd0f97a0907140919j645d03c3nac348d2106b63bef@mail.gmail.com>
Date: Tue, 14 Jul 2009 12:19:04 -0400
From: Mike Frysinger <vapier.adi@...il.com>
To: Johannes Weiner <hannes@...xchg.org>
Cc: linux-kernel@...r.kernel.org,
uclinux-dist-devel@...ckfin.uclinux.org,
Bernd Schmidt <bernds_cb1@...nline.de>,
Bryan Wu <cooloney@...nel.org>,
David Howells <dhowells@...hat.com>
Subject: Re: [PATCH] NOMMU: add support for Memory Protection Units (MPU)
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists