From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andi Kleen <andi@firstfloor.org>,
Pallipadi Venkatesh <venki@google.com>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Nick Piggin <npiggin@kernel.dk>
Subject: Re: [x86 PAT PATCH 1/2] x86, pat: remove the dependency on 'vm_pgoff' in track/untrack pfn vma routines
Date: Tue, 03 Apr 2012 09:37:24 +0400 [thread overview]
Message-ID: <4F7A8C94.3040708@openvz.org> (raw)
In-Reply-To: <1333413969-30761-2-git-send-email-suresh.b.siddha@intel.com>
Suresh Siddha wrote:
> 'pfn' argument for track_pfn_vma_new() can be used for reserving the attribute
> for the pfn range. No need to depend on 'vm_pgoff'
>
> Similarly, untrack_pfn_vma() can depend on the 'pfn' argument if it
> is non-zero or can use follow_phys() to get the starting value of the pfn
> range.
>
> Also the non zero 'size' argument can be used instead of recomputing
> it from vma.
>
> This cleanup also prepares the ground for the track/untrack pfn vma routines
> to take over the ownership of setting PAT specific vm_flag in the 'vma'.
>
> Signed-off-by: Suresh Siddha<suresh.b.siddha@intel.com>
> Cc: Venkatesh Pallipadi<venki@google.com>
> Cc: Konstantin Khlebnikov<khlebnikov@openvz.org>
> ---
> arch/x86/mm/pat.c | 30 +++++++++++++++++-------------
> 1 files changed, 17 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
> index f6ff57b..617f42b 100644
> --- a/arch/x86/mm/pat.c
> +++ b/arch/x86/mm/pat.c
> @@ -693,14 +693,10 @@ int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot,
> unsigned long pfn, unsigned long size)
> {
> unsigned long flags;
> - resource_size_t paddr;
> - unsigned long vma_size = vma->vm_end - vma->vm_start;
>
> - if (is_linear_pfn_mapping(vma)) {
> - /* reserve the whole chunk starting from vm_pgoff */
> - paddr = (resource_size_t)vma->vm_pgoff<< PAGE_SHIFT;
> - return reserve_pfn_range(paddr, vma_size, prot, 0);
> - }
> + /* reserve the whole chunk starting from pfn */
> + if (is_linear_pfn_mapping(vma))
> + return reserve_pfn_range(pfn, size, prot, 0);
you mix here pfn and paddr: old code passes paddr as first argument of reserve_pfn_range().
>
> if (!pat_enabled)
> return 0;
> @@ -716,20 +712,28 @@ int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot,
> /*
> * untrack_pfn_vma is called while unmapping a pfnmap for a region.
> * untrack can be called for a specific region indicated by pfn and size or
> - * can be for the entire vma (in which case size can be zero).
> + * can be for the entire vma (in which case pfn, size are zero).
> */
> void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
> unsigned long size)
> {
> resource_size_t paddr;
> - unsigned long vma_size = vma->vm_end - vma->vm_start;
> + unsigned long prot;
>
> - if (is_linear_pfn_mapping(vma)) {
> - /* free the whole chunk starting from vm_pgoff */
> - paddr = (resource_size_t)vma->vm_pgoff<< PAGE_SHIFT;
> - free_pfn_range(paddr, vma_size);
> + if (!is_linear_pfn_mapping(vma))
> return;
> +
> + /* free the chunk starting from pfn or the whole chunk */
> + paddr = (resource_size_t)pfn;
> + if (!paddr&& !size) {
> + if (follow_phys(vma, vma->vm_start, 0,&prot,&paddr)) {
> + WARN_ON_ONCE(1);
> + return;
> + }
> +
> + size = vma->vm_end - vma->vm_start;
> }
> + free_pfn_range(paddr, size);
> }
>
> pgprot_t pgprot_writecombine(pgprot_t prot)
next prev parent reply other threads:[~2012-04-03 5:37 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-31 9:25 [PATCH 0/7] mm: vma->vm_flags diet Konstantin Khlebnikov
2012-03-31 9:29 ` [PATCH 1/7] mm, x86, PAT: rework linear pfn-mmap tracking Konstantin Khlebnikov
2012-03-31 17:09 ` [PATCH 1/7 v2] " Konstantin Khlebnikov
2012-04-03 0:46 ` [x86 PAT PATCH 0/2] x86 PAT vm_flag code refactoring Suresh Siddha
2012-04-03 0:46 ` [x86 PAT PATCH 1/2] x86, pat: remove the dependency on 'vm_pgoff' in track/untrack pfn vma routines Suresh Siddha
2012-04-03 5:37 ` Konstantin Khlebnikov [this message]
2012-04-03 23:31 ` Suresh Siddha
2012-04-04 4:43 ` Konstantin Khlebnikov
2012-04-05 11:56 ` Konstantin Khlebnikov
2012-04-06 0:01 ` [v3 VM_PAT PATCH 0/3] x86 VM_PAT series Suresh Siddha
2012-04-06 0:01 ` [v3 VM_PAT PATCH 1/3] x86, pat: remove the dependency on 'vm_pgoff' in track/untrack pfn vma routines Suresh Siddha
2012-04-06 0:01 ` [v3 VM_PAT PATCH 2/3] x86, pat: separate the pfn attribute tracking for remap_pfn_range and vm_insert_pfn Suresh Siddha
2012-04-06 0:01 ` [v3 VM_PAT PATCH 3/3] mm, x86, PAT: rework linear pfn-mmap tracking Suresh Siddha
2012-04-03 0:46 ` [x86 PAT PATCH 2/2] " Suresh Siddha
2012-04-03 5:48 ` Konstantin Khlebnikov
2012-04-03 5:55 ` Konstantin Khlebnikov
2012-04-03 6:03 ` [x86 PAT PATCH 0/2] x86 PAT vm_flag code refactoring Konstantin Khlebnikov
2012-04-03 23:14 ` Suresh Siddha
2012-04-04 4:40 ` Konstantin Khlebnikov
2012-03-31 9:29 ` [PATCH 2/7] mm: introduce vma flag VM_ARCH_1 Konstantin Khlebnikov
2012-03-31 22:25 ` Benjamin Herrenschmidt
2012-03-31 9:29 ` [PATCH 3/7] mm: kill vma flag VM_CAN_NONLINEAR Konstantin Khlebnikov
2012-03-31 17:01 ` Linus Torvalds
2012-03-31 9:29 ` [PATCH 4/7] mm: kill vma flag VM_INSERTPAGE Konstantin Khlebnikov
2012-03-31 9:29 ` [PATCH 5/7] mm, drm/udl: fixup vma flags on mmap Konstantin Khlebnikov
2012-03-31 9:29 ` [PATCH 6/7] mm: kill vma flag VM_EXECUTABLE Konstantin Khlebnikov
2012-03-31 20:13 ` Oleg Nesterov
2012-03-31 20:39 ` Cyrill Gorcunov
2012-04-02 9:46 ` Konstantin Khlebnikov
2012-04-02 9:54 ` Cyrill Gorcunov
2012-04-02 10:13 ` Konstantin Khlebnikov
2012-04-02 14:48 ` Oleg Nesterov
2012-04-02 16:02 ` Cyrill Gorcunov
2012-04-02 16:19 ` Konstantin Khlebnikov
2012-04-02 16:27 ` Cyrill Gorcunov
2012-04-02 17:14 ` Konstantin Khlebnikov
2012-04-02 18:05 ` Cyrill Gorcunov
2012-04-02 23:04 ` Matt Helsley
2012-04-03 5:10 ` Konstantin Khlebnikov
2012-04-03 18:16 ` Matt Helsley
2012-04-03 19:32 ` Cyrill Gorcunov
2012-04-05 20:29 ` Matt Helsley
2012-04-05 20:53 ` Cyrill Gorcunov
2012-04-05 21:04 ` Konstantin Khlebnikov
2012-04-05 21:44 ` Matt Helsley
2012-04-05 21:55 ` Linus Torvalds
2012-04-06 4:36 ` Konstantin Khlebnikov
2012-04-02 23:18 ` Matt Helsley
2012-04-03 5:06 ` Konstantin Khlebnikov
2012-04-06 22:48 ` Andrew Morton
2012-03-31 9:29 ` [PATCH 7/7] mm: move madvise vma flags to the end Konstantin Khlebnikov
2012-03-31 14:06 ` [PATCH 0/7] mm: vma->vm_flags diet Andi Kleen
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=4F7A8C94.3040708@openvz.org \
--to=khlebnikov@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=hpa@zytor.com \
--cc=koct9i@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=npiggin@kernel.dk \
--cc=suresh.b.siddha@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=venki@google.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 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).