All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jie Zhang <jie.zhang@analog.com>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: David Howells <dhowells@redhat.com>,
	Paul Mundt <lethal@linux-sh.org>,
	Bernd Schmidt <bernds_cb1@t-online.de>,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>,
	uclinux-dist-devel <uclinux-dist-devel@blackfin.uclinux.org>
Subject: Re: avoiding duplicate icache flushing of shared maps on nommu
Date: Mon, 30 Nov 2009 11:18:06 +0800	[thread overview]
Message-ID: <4B13396E.508@analog.com> (raw)
In-Reply-To: <8bd0f97a0911280740p24ad49bal64b924a427abfa39@mail.gmail.com>

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


  parent reply	other threads:[~2009-11-30  3:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-28 15:40 avoiding duplicate icache flushing of shared maps on nommu Mike Frysinger
2009-11-28 18:53 ` Mike Frysinger
2009-11-30  3:18 ` Jie Zhang [this message]
2009-12-02 14:15 ` David Howells
2009-12-02 21:40   ` Mike Frysinger
2009-12-02 23:51     ` David Howells
2009-12-02 22:41   ` Mike Frysinger
2009-12-03 16:14     ` David Howells

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=4B13396E.508@analog.com \
    --to=jie.zhang@analog.com \
    --cc=bernds_cb1@t-online.de \
    --cc=dhowells@redhat.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    --cc=vapier.adi@gmail.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.