[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180816092116.GT32645@dhcp22.suse.cz>
Date: Thu, 16 Aug 2018 11:21:16 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Li RongQing <lirongqing@...du.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Dan Williams <dan.j.williams@...el.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Matthew Wilcox <mawilcox@...rosoft.com>,
Souptick Joarder <jrdr.linux@...il.com>
Subject: Re: [PATCH] mm: introduce kvvirt_to_page() helper
On Thu 16-08-18 17:17:37, Li RongQing wrote:
> The new helper returns address mapping page, which has several users
> in individual subsystem, like mem_to_page in xfs_buf.c and pgv_to_page
> in af_packet.c, after this, they can be unified
Please add users along with the new helper.
>
> Signed-off-by: Zhang Yu <zhangyu31@...du.com>
> Signed-off-by: Li RongQing <lirongqing@...du.com>
> ---
> include/linux/mm.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 68a5121694ef..bb34a3c71df5 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -599,6 +599,14 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
> return kvmalloc_array(n, size, flags | __GFP_ZERO);
> }
>
> +static inline struct page *kvvirt_to_page(const void *addr)
> +{
> + if (!is_vmalloc_addr(addr))
> + return virt_to_page(addr);
> + else
> + return vmalloc_to_page(addr);
> +}
> +
> extern void kvfree(const void *addr);
>
> static inline atomic_t *compound_mapcount_ptr(struct page *page)
> --
> 2.16.2
>
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists