diff mbox series

[v2,04/11] mm: Make page_mapped_in_vma conditional on CONFIG_MEMORY_FAILURE

Message ID 20240408194232.118537-5-willy@infradead.org (mailing list archive)
State New
Headers show
Series Some cleanups for memory-failure | expand

Commit Message

Matthew Wilcox April 8, 2024, 7:42 p.m. UTC
This function is only currently used by the memory-failure code, so
we can omit it if we're not compiling in the memory-failure code.

Suggested-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/page_vma_mapped.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jane Chu April 8, 2024, 10:45 p.m. UTC | #1
On 4/8/2024 12:42 PM, Matthew Wilcox (Oracle) wrote:

> This function is only currently used by the memory-failure code, so
> we can omit it if we're not compiling in the memory-failure code.
>
> Suggested-by: Miaohe Lin <linmiaohe@huawei.com>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   mm/page_vma_mapped.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
> index 48bfc17934cd..6e06267fc220 100644
> --- a/mm/page_vma_mapped.c
> +++ b/mm/page_vma_mapped.c
> @@ -314,6 +314,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
>   	return false;
>   }
>   
> +#ifdef CONFIG_MEMORY_FAILURE
>   /**
>    * page_mapped_in_vma - check whether a page is really mapped in a VMA
>    * @page: the page to test
> @@ -344,3 +345,4 @@ int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
>   out:
>   	return pvmw.address;
>   }
> +#endif

Should below be put in the CONFIG_MEMORY_FAILURE bracket as well ?

include/linux/rmap.h: int page_mapped_in_vma(struct page *page, struct 
vm_area_struct *vma);

with that,

Reviewed-by: Jane Chu <jane.chu@oracle.com>

thanks,

-jane
Matthew Wilcox April 8, 2024, 10:52 p.m. UTC | #2
On Mon, Apr 08, 2024 at 03:45:37PM -0700, Jane Chu wrote:
> On 4/8/2024 12:42 PM, Matthew Wilcox (Oracle) wrote:
> > +#ifdef CONFIG_MEMORY_FAILURE
> >   /**
> >    * page_mapped_in_vma - check whether a page is really mapped in a VMA
> >    * @page: the page to test
> > @@ -344,3 +345,4 @@ int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
> >   out:
> >   	return pvmw.address;
> >   }
> > +#endif
> 
> Should below be put in the CONFIG_MEMORY_FAILURE bracket as well ?
> 
> include/linux/rmap.h: int page_mapped_in_vma(struct page *page, struct
> vm_area_struct *vma);

I don't see why we should; I see no advantage to adding that ifdef.
What would motivate you to add it?

> with that,
> 
> Reviewed-by: Jane Chu <jane.chu@oracle.com>

Thanks!
Jane Chu April 9, 2024, 6:35 a.m. UTC | #3
On 4/8/2024 3:52 PM, Matthew Wilcox wrote:

> On Mon, Apr 08, 2024 at 03:45:37PM -0700, Jane Chu wrote:
>> On 4/8/2024 12:42 PM, Matthew Wilcox (Oracle) wrote:
>>> +#ifdef CONFIG_MEMORY_FAILURE
>>>    /**
>>>     * page_mapped_in_vma - check whether a page is really mapped in a VMA
>>>     * @page: the page to test
>>> @@ -344,3 +345,4 @@ int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
>>>    out:
>>>    	return pvmw.address;
>>>    }
>>> +#endif
>> Should below be put in the CONFIG_MEMORY_FAILURE bracket as well ?
>>
>> include/linux/rmap.h: int page_mapped_in_vma(struct page *page, struct
>> vm_area_struct *vma);
> I don't see why we should; I see no advantage to adding that ifdef.
> What would motivate you to add it?

Just to be consistent, like, either both function definition and 
function declaration be put in the config switch bracket, or neither.  
Perhaps this is a nitpick, up to you.

Thanks,

-jane

>
>> with that,
>>
>> Reviewed-by: Jane Chu <jane.chu@oracle.com>
> Thanks!
Oscar Salvador April 10, 2024, 9:39 a.m. UTC | #4
On Mon, Apr 08, 2024 at 08:42:22PM +0100, Matthew Wilcox (Oracle) wrote:
> This function is only currently used by the memory-failure code, so
> we can omit it if we're not compiling in the memory-failure code.
> 
> Suggested-by: Miaohe Lin <linmiaohe@huawei.com>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Reviewed-by: Oscar Salvador <osalvador@suse.de>
diff mbox series

Patch

diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
index 48bfc17934cd..6e06267fc220 100644
--- a/mm/page_vma_mapped.c
+++ b/mm/page_vma_mapped.c
@@ -314,6 +314,7 @@  bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
 	return false;
 }
 
+#ifdef CONFIG_MEMORY_FAILURE
 /**
  * page_mapped_in_vma - check whether a page is really mapped in a VMA
  * @page: the page to test
@@ -344,3 +345,4 @@  int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
 out:
 	return pvmw.address;
 }
+#endif