lkml.org 
[lkml]   [2009]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: avoiding duplicate icache flushing of shared maps on nommu
On 11/28/2009 11:40 PM, Mike Frysinger wrote:
> when working with FDPIC, there are many shared maps of read only text
> regions (the C library, applet packages like busybox, ...) between
> applications. but the current mm/nommu.c:do_mmap_pgoff() function
> will issue an icache flush whenever a vma is added to a mm instead of
> only doing it when the map is initially created. am i missing
> something obvious here, or would a change like below be OK ? this
> easily cuts the number of icache flushes during boot by 50% if not
> more.
>
> (yes, this now does the icache flush while holding the
> nommu_region_sem, but i'm interested if the _idea_ is OK)
>
I don't see any problem. But I'm not a kernel expert. I tried to take a
look at the source code history. But I cannot find code older than
2.6.12. In the CVS repository of uClinux, there is no similar code in
kernel sub-directory. :-(


Jie


> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -1409,14 +1409,14 @@ unsigned long do_mmap_pgoff(struct file *file,
>
> current->mm->total_vm += len>> PAGE_SHIFT;
>
> + if (prot& PROT_EXEC)
> + flush_icache_range(result, result + len);
> +
> share:
> add_vma_to_mm(current->mm, vma);
>
> up_write(&nommu_region_sem);
>
> - if (prot& PROT_EXEC)
> - flush_icache_range(result, result + len);
> -
> kleave(" = %lx", result);
> return result;
>
> -mike



\
 
 \ /
  Last update: 2009-11-30 04:21    [W:0.147 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site