diff mbox

[RFC,XEN,v3,02/39] x86_64/mm: drop redundant MFN to page conventions in cleanup_frame_table()

Message ID 20170911043820.14617-3-haozhong.zhang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Haozhong Zhang Sept. 11, 2017, 4:37 a.m. UTC
Replace pdx_to_page(pfn_to_pdx(pfn)) by mfn_to_page(pfn), which is
identical to the former.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_64/mm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Chao Peng Oct. 27, 2017, 6:58 a.m. UTC | #1
On Mon, 2017-09-11 at 12:37 +0800, Haozhong Zhang wrote:
> Replace pdx_to_page(pfn_to_pdx(pfn)) by mfn_to_page(pfn), which is
> identical to the former.

Looks good to me.

Chao
> 
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> ---
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  xen/arch/x86/x86_64/mm.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
> index 6c5221f90c..c93383d7d9 100644
> --- a/xen/arch/x86/x86_64/mm.c
> +++ b/xen/arch/x86/x86_64/mm.c
> @@ -720,12 +720,11 @@ static void cleanup_frame_table(struct
> mem_hotadd_info *info)
>      spfn = info->spfn;
>      epfn = info->epfn;
>  
> -    sva = (unsigned long)pdx_to_page(pfn_to_pdx(spfn));
> -    eva = (unsigned long)pdx_to_page(pfn_to_pdx(epfn));
> +    sva = (unsigned long)mfn_to_page(spfn);
> +    eva = (unsigned long)mfn_to_page(epfn);
>  
>      /* Intialize all page */
> -    memset(mfn_to_page(spfn), -1,
> -           (unsigned long)mfn_to_page(epfn) - (unsigned
> long)mfn_to_page(spfn));
> +    memset((void *)sva, -1, eva - sva);
>  
>      while (sva < eva)
>      {
Andrew Cooper Oct. 27, 2017, 9:24 a.m. UTC | #2
On 27/10/17 07:58, Chao Peng wrote:
> On Mon, 2017-09-11 at 12:37 +0800, Haozhong Zhang wrote:
>> Replace pdx_to_page(pfn_to_pdx(pfn)) by mfn_to_page(pfn), which is
>> identical to the former.
> Looks good to me.

Is that a Reviewed-by: then?

>
> Chao
>> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
>> ---
>> Cc: Jan Beulich <jbeulich@suse.com>
>> Cc: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Given that this is a trivial cleanup patch, I will include it in the
x86-next branch I am maintaining until the 4.11 release window opens.

~Andrew
Chao Peng Oct. 30, 2017, 2:21 a.m. UTC | #3
On Fri, 2017-10-27 at 10:24 +0100, Andrew Cooper wrote:
> On 27/10/17 07:58, Chao Peng wrote:
> > 
> > On Mon, 2017-09-11 at 12:37 +0800, Haozhong Zhang wrote:
> > > 
> > > Replace pdx_to_page(pfn_to_pdx(pfn)) by mfn_to_page(pfn), which is
> > > identical to the former.
> > Looks good to me.
> 
> Is that a Reviewed-by: then?

Yes, Reviewed-by: Chao Peng <chao.p.peng@linux.intel.com>

> 
> > 
> > 
> > Chao
> > > 
> > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > > ---
> > > Cc: Jan Beulich <jbeulich@suse.com>
> > > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> Given that this is a trivial cleanup patch, I will include it in the
> x86-next branch I am maintaining until the 4.11 release window opens.
> 
> ~Andrew
diff mbox

Patch

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 6c5221f90c..c93383d7d9 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -720,12 +720,11 @@  static void cleanup_frame_table(struct mem_hotadd_info *info)
     spfn = info->spfn;
     epfn = info->epfn;
 
-    sva = (unsigned long)pdx_to_page(pfn_to_pdx(spfn));
-    eva = (unsigned long)pdx_to_page(pfn_to_pdx(epfn));
+    sva = (unsigned long)mfn_to_page(spfn);
+    eva = (unsigned long)mfn_to_page(epfn);
 
     /* Intialize all page */
-    memset(mfn_to_page(spfn), -1,
-           (unsigned long)mfn_to_page(epfn) - (unsigned long)mfn_to_page(spfn));
+    memset((void *)sva, -1, eva - sva);
 
     while (sva < eva)
     {