linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: cl@linux-foundation.org, "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [RFC MM 3/4] add mm version number
Date: Sat, 14 Nov 2009 00:27:48 +0900	[thread overview]
Message-ID: <28c262360911130727s25c34179u30360765c08853e0@mail.gmail.com> (raw)
In-Reply-To: <20091113164029.e7e8bcea.kamezawa.hiroyu@jp.fujitsu.com>

Hi, Kame.

On Fri, Nov 13, 2009 at 4:40 PM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> Add logical timestamp to mm_struct, which is incremented always
> mmap_sem(write) is got and released. By this, it works like seqlock's
> counter and indicates mm_struct is modified or not.
>
> And this adds vma_cache to each thread. Each thread remember the last
> faulted vma and grab reference count. Correctness of cache is checked by
> mm->generation timestamp. (mm struct's vma cache is not very good
> if mm is shared, I think)
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
>  arch/x86/mm/fault.c       |   18 ++++++++++++++++--
>  fs/exec.c                 |    4 ++++
>  include/linux/init_task.h |    1 +
>  include/linux/mm_types.h  |   11 ++++++++++-
>  include/linux/sched.h     |    4 ++++
>  kernel/exit.c             |    3 +++
>  kernel/fork.c             |    5 ++++-
>  7 files changed, 42 insertions(+), 4 deletions(-)
>
> Index: mmotm-2.6.32-Nov2/include/linux/mm_types.h
> ===================================================================
> --- mmotm-2.6.32-Nov2.orig/include/linux/mm_types.h
> +++ mmotm-2.6.32-Nov2/include/linux/mm_types.h
> @@ -216,6 +216,7 @@ struct mm_struct {
>        atomic_t mm_users;                      /* How many users with user space? */
>        atomic_t mm_count;                      /* How many references to "struct mm_struct" (users count as 1) */
>        int map_count;                          /* number of VMAs */
> +       unsigned int generation;                /* logical timestamp of last modification */
>        struct rw_semaphore sem;
>        spinlock_t page_table_lock;             /* Protects page tables and some counters */
>
> @@ -308,16 +309,21 @@ static inline int mm_reader_trylock(stru
>  static inline void mm_writer_lock(struct mm_struct *mm)
>  {
>        down_write(&mm->sem);
> +       mm->generation++;
>  }
>
>  static inline void mm_writer_unlock(struct mm_struct *mm)
>  {
> +       mm->generation++;
>        up_write(&mm->sem);
>  }
>
>  static inline int mm_writer_trylock(struct mm_struct *mm)
>  {
> -       return down_write_trylock(&mm->sem);
> +       int ret = down_write_trylock(&mm->sem);
> +       if (!ret)

It seems your typo.
if (ret) ?

> +               mm->generation++;
> +       return ret;
>  }

-- 
Kind regards,
Minchan Kim

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-11-13 15:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13  7:35 [RFC MM] speculative page fault KAMEZAWA Hiroyuki
2009-11-13  7:37 ` [RFC MM 1/4] mm accessor (updated) KAMEZAWA Hiroyuki
2009-11-13  7:38 ` [RFC MM 2/4] refcnt for vm_area_struct KAMEZAWA Hiroyuki
2009-11-13  7:40 ` [RFC MM 3/4] add mm version number KAMEZAWA Hiroyuki
2009-11-13 15:27   ` Minchan Kim [this message]
2009-11-13 16:26     ` KAMEZAWA Hiroyuki
2009-11-13  7:41 ` [RFC MM 4/4] speculative page fault KAMEZAWA Hiroyuki
2009-11-13 15:59   ` Minchan Kim
2009-11-13 16:28     ` KAMEZAWA Hiroyuki
2009-11-13 16:20 ` [RFC MM] " Minchan Kim
2009-11-13 16:38   ` KAMEZAWA Hiroyuki

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=28c262360911130727s25c34179u30360765c08853e0@mail.gmail.com \
    --to=minchan.kim@gmail.com \
    --cc=cl@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.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