From: Hugh Dickins <hughd@google.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-arch@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: Allow arch code to control the user page table ceiling
Date: Tue, 19 Feb 2013 10:08:12 -0800 (PST) [thread overview]
Message-ID: <alpine.LNX.2.00.1302191005320.2139@eggly.anvils> (raw)
In-Reply-To: <1361204311-14127-2-git-send-email-catalin.marinas@arm.com>
On Mon, 18 Feb 2013, Catalin Marinas wrote:
> From: Hugh Dickins <hughd@google.com>
You're being generous to me :)
Thanks for doing most of the work, yes, this looks fine.
BUt I'd have expected a Cc stable below: see comment on 2/2.
Hugh
>
> On architectures where a pgd entry may be shared between user and kernel
> (ARM+LPAE), freeing page tables needs a ceiling other than 0. This patch
> introduces a generic USER_PGTABLES_CEILING that arch code can override.
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> [catalin.marinas@arm.com: commit log; shift_arg_pages(), asm-generic/pgtables.h changes]
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
> fs/exec.c | 4 ++--
> include/asm-generic/pgtable.h | 10 ++++++++++
> mm/mmap.c | 4 ++--
> 3 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/fs/exec.c b/fs/exec.c
> index 20df02c..547eaaa 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -613,7 +613,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
> * when the old and new regions overlap clear from new_end.
> */
> free_pgd_range(&tlb, new_end, old_end, new_end,
> - vma->vm_next ? vma->vm_next->vm_start : 0);
> + vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
> } else {
> /*
> * otherwise, clean from old_start; this is done to not touch
> @@ -622,7 +622,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
> * for the others its just a little faster.
> */
> free_pgd_range(&tlb, old_start, old_end, new_end,
> - vma->vm_next ? vma->vm_next->vm_start : 0);
> + vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
> }
> tlb_finish_mmu(&tlb, new_end, old_end);
>
> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
> index 5cf680a..f50a87d 100644
> --- a/include/asm-generic/pgtable.h
> +++ b/include/asm-generic/pgtable.h
> @@ -7,6 +7,16 @@
> #include <linux/mm_types.h>
> #include <linux/bug.h>
>
> +/*
> + * On almost all architectures and configurations, 0 can be used as the
> + * upper ceiling to free_pgtables(): on many architectures it has the same
> + * effect as using TASK_SIZE. However, there is one configuration which
> + * must impose a more careful limit, to avoid freeing kernel pgtables.
> + */
> +#ifndef USER_PGTABLES_CEILING
> +#define USER_PGTABLES_CEILING 0UL
> +#endif
> +
> #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
> extern int ptep_set_access_flags(struct vm_area_struct *vma,
> unsigned long address, pte_t *ptep,
> diff --git a/mm/mmap.c b/mm/mmap.c
> index d1e4124..e262710 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2262,7 +2262,7 @@ static void unmap_region(struct mm_struct *mm,
> update_hiwater_rss(mm);
> unmap_vmas(&tlb, vma, start, end);
> free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
> - next ? next->vm_start : 0);
> + next ? next->vm_start : USER_PGTABLES_CEILING);
> tlb_finish_mmu(&tlb, start, end);
> }
>
> @@ -2640,7 +2640,7 @@ void exit_mmap(struct mm_struct *mm)
> /* Use -1 here to ensure all VMAs in the mm are unmapped */
> unmap_vmas(&tlb, vma, 0, -1);
>
> - free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, 0);
> + free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, USER_PGTABLES_CEILING);
> tlb_finish_mmu(&tlb, 0, -1);
>
> /*
>
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Hugh Dickins <hughd@google.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-arch@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: Allow arch code to control the user page table ceiling
Date: Tue, 19 Feb 2013 10:08:12 -0800 (PST) [thread overview]
Message-ID: <alpine.LNX.2.00.1302191005320.2139@eggly.anvils> (raw)
Message-ID: <20130219180812.Pey71uOBiUlDsOa3rEWVRKztmvAzsdpTHAtK6RROLEE@z> (raw)
In-Reply-To: <1361204311-14127-2-git-send-email-catalin.marinas@arm.com>
On Mon, 18 Feb 2013, Catalin Marinas wrote:
> From: Hugh Dickins <hughd@google.com>
You're being generous to me :)
Thanks for doing most of the work, yes, this looks fine.
BUt I'd have expected a Cc stable below: see comment on 2/2.
Hugh
>
> On architectures where a pgd entry may be shared between user and kernel
> (ARM+LPAE), freeing page tables needs a ceiling other than 0. This patch
> introduces a generic USER_PGTABLES_CEILING that arch code can override.
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> [catalin.marinas@arm.com: commit log; shift_arg_pages(), asm-generic/pgtables.h changes]
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
> fs/exec.c | 4 ++--
> include/asm-generic/pgtable.h | 10 ++++++++++
> mm/mmap.c | 4 ++--
> 3 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/fs/exec.c b/fs/exec.c
> index 20df02c..547eaaa 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -613,7 +613,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
> * when the old and new regions overlap clear from new_end.
> */
> free_pgd_range(&tlb, new_end, old_end, new_end,
> - vma->vm_next ? vma->vm_next->vm_start : 0);
> + vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
> } else {
> /*
> * otherwise, clean from old_start; this is done to not touch
> @@ -622,7 +622,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
> * for the others its just a little faster.
> */
> free_pgd_range(&tlb, old_start, old_end, new_end,
> - vma->vm_next ? vma->vm_next->vm_start : 0);
> + vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
> }
> tlb_finish_mmu(&tlb, new_end, old_end);
>
> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
> index 5cf680a..f50a87d 100644
> --- a/include/asm-generic/pgtable.h
> +++ b/include/asm-generic/pgtable.h
> @@ -7,6 +7,16 @@
> #include <linux/mm_types.h>
> #include <linux/bug.h>
>
> +/*
> + * On almost all architectures and configurations, 0 can be used as the
> + * upper ceiling to free_pgtables(): on many architectures it has the same
> + * effect as using TASK_SIZE. However, there is one configuration which
> + * must impose a more careful limit, to avoid freeing kernel pgtables.
> + */
> +#ifndef USER_PGTABLES_CEILING
> +#define USER_PGTABLES_CEILING 0UL
> +#endif
> +
> #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
> extern int ptep_set_access_flags(struct vm_area_struct *vma,
> unsigned long address, pte_t *ptep,
> diff --git a/mm/mmap.c b/mm/mmap.c
> index d1e4124..e262710 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2262,7 +2262,7 @@ static void unmap_region(struct mm_struct *mm,
> update_hiwater_rss(mm);
> unmap_vmas(&tlb, vma, start, end);
> free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
> - next ? next->vm_start : 0);
> + next ? next->vm_start : USER_PGTABLES_CEILING);
> tlb_finish_mmu(&tlb, start, end);
> }
>
> @@ -2640,7 +2640,7 @@ void exit_mmap(struct mm_struct *mm)
> /* Use -1 here to ensure all VMAs in the mm are unmapped */
> unmap_vmas(&tlb, vma, 0, -1);
>
> - free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, 0);
> + free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, USER_PGTABLES_CEILING);
> tlb_finish_mmu(&tlb, 0, -1);
>
> /*
>
next prev parent reply other threads:[~2013-02-19 18:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-18 16:18 [PATCH 0/2] Arch-specific user pgtables ceiling Catalin Marinas
2013-02-18 16:18 ` Catalin Marinas
2013-02-18 16:18 ` [PATCH 1/2] mm: Allow arch code to control the user page table ceiling Catalin Marinas
2013-02-18 16:18 ` Catalin Marinas
2013-02-19 18:08 ` Hugh Dickins [this message]
2013-02-19 18:08 ` Hugh Dickins
2013-02-19 22:33 ` Catalin Marinas
2013-02-19 22:33 ` Catalin Marinas
2013-02-18 16:18 ` [PATCH 2/2] arm: Set the page table freeing ceiling to TASK_SIZE Catalin Marinas
2013-02-18 16:18 ` Catalin Marinas
2013-02-19 18:20 ` Hugh Dickins
2013-02-19 18:20 ` Hugh Dickins
2013-02-19 22:55 ` Catalin Marinas
2013-02-19 22:55 ` Catalin Marinas
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=alpine.LNX.2.00.1302191005320.2139@eggly.anvils \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@arm.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).