lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <28c262360905161836u332f9e9aj6fa3f3b65da95592@mail.gmail.com>
Date:	Sun, 17 May 2009 10:36:44 +0900
From:	Minchan Kim <minchan.kim@...il.com>
To:	Wu Fengguang <fengguang.wu@...el.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Johannes Weiner <hannes@...xchg.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Christoph Lameter <cl@...ux-foundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	"riel@...hat.com" <riel@...hat.com>,
	"tytso@....edu" <tytso@....edu>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"elladan@...imo.com" <elladan@...imo.com>,
	"npiggin@...e.de" <npiggin@...e.de>
Subject: Re: [PATCH 1/3] vmscan: report vm_flags in page_referenced()

On Sat, May 16, 2009 at 6:00 PM, Wu Fengguang <fengguang.wu@...el.com> wrote:
> Collect vma->vm_flags of the VMAs that actually referenced the page.
>
> This is preparing for more informed reclaim heuristics,
> eg. to protect executable file pages more aggressively.
> For now only the VM_EXEC bit will be used by the caller.
>
> CC: Minchan Kim <minchan.kim@...il.com>
> CC: Johannes Weiner <hannes@...xchg.org>
> CC: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
> ---
>  include/linux/rmap.h |    5 +++--
>  mm/rmap.c            |   37 ++++++++++++++++++++++++++-----------
>  mm/vmscan.c          |    7 +++++--
>  3 files changed, 34 insertions(+), 15 deletions(-)
>
> --- linux.orig/include/linux/rmap.h
> +++ linux/include/linux/rmap.h
> @@ -83,7 +83,8 @@ static inline void page_dup_rmap(struct
>  /*
>  * Called from mm/vmscan.c to handle paging out
>  */
> -int page_referenced(struct page *, int is_locked, struct mem_cgroup *cnt);
> +int page_referenced(struct page *, int is_locked,
> +                       struct mem_cgroup *cnt, unsigned long *vm_flags);
>  int try_to_unmap(struct page *, int ignore_refs);
>
>  /*
> @@ -128,7 +129,7 @@ int page_wrprotect(struct page *page, in
>  #define anon_vma_prepare(vma)  (0)
>  #define anon_vma_link(vma)     do {} while (0)
>
> -#define page_referenced(page,l,cnt) TestClearPageReferenced(page)
> +#define page_referenced(page, locked, cnt, flags) TestClearPageReferenced(page)
>  #define try_to_unmap(page, refs) SWAP_FAIL
>
>  static inline int page_mkclean(struct page *page)
> --- linux.orig/mm/rmap.c
> +++ linux/mm/rmap.c
> @@ -333,7 +333,9 @@ static int page_mapped_in_vma(struct pag
>  * repeatedly from either page_referenced_anon or page_referenced_file.
>  */
>  static int page_referenced_one(struct page *page,
> -       struct vm_area_struct *vma, unsigned int *mapcount)
> +                              struct vm_area_struct *vma,
> +                              unsigned int *mapcount,
> +                              unsigned long *vm_flags)
>  {
>        struct mm_struct *mm = vma->vm_mm;
>        unsigned long address;
> @@ -381,11 +383,14 @@ out_unmap:
>        (*mapcount)--;
>        pte_unmap_unlock(pte, ptl);
>  out:
> +       if (referenced)
> +               *vm_flags |= vma->vm_flags;
>        return referenced;
>  }
>
>  static int page_referenced_anon(struct page *page,
> -                               struct mem_cgroup *mem_cont)
> +                               struct mem_cgroup *mem_cont,
> +                               unsigned long *vm_flags)
>  {
>        unsigned int mapcount;
>        struct anon_vma *anon_vma;
> @@ -405,7 +410,8 @@ static int page_referenced_anon(struct p
>                 */
>                if (mem_cont && !mm_match_cgroup(vma->vm_mm, mem_cont))
>                        continue;
> -               referenced += page_referenced_one(page, vma, &mapcount);
> +               referenced += page_referenced_one(page, vma,
> +                                                 &mapcount, vm_flags);
>                if (!mapcount)
>                        break;
>        }
> @@ -418,6 +424,7 @@ static int page_referenced_anon(struct p
>  * page_referenced_file - referenced check for object-based rmap
>  * @page: the page we're checking references on.
>  * @mem_cont: target memory controller
> + * @vm_flags: collect encountered vma->vm_flags

I missed this.
To clarify, how about ?
collect encountered vma->vm_flags among vma which referenced the page

-- 
Kinds regards,
Minchan Kim
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ