linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Li RongQing <lirongqing@baidu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Matthew Wilcox <mawilcox@microsoft.com>,
	Souptick Joarder <jrdr.linux@gmail.com>
Subject: Re: [PATCH] mm: introduce kvvirt_to_page() helper
Date: Thu, 16 Aug 2018 11:21:16 +0200	[thread overview]
Message-ID: <20180816092116.GT32645@dhcp22.suse.cz> (raw)
In-Reply-To: <1534411057-26276-1-git-send-email-lirongqing@baidu.com>

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@baidu.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.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

  reply	other threads:[~2018-08-16  9:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16  9:17 [PATCH] mm: introduce kvvirt_to_page() helper Li RongQing
2018-08-16  9:21 ` Michal Hocko [this message]
     [not found] <1534596541-31393-1-git-send-email-lirongqing@baidu.com>
2018-08-20 14:41 ` Michal Hocko
2018-08-20 14:49   ` Matthew Wilcox
2018-08-20 16:24     ` Michal Hocko
2018-08-20 17:07       ` Matthew Wilcox
2018-08-20 19:15         ` Michal Hocko
2018-08-20 21:53         ` Dave Chinner
2018-08-20 17:38   ` Matthew Wilcox

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=20180816092116.GT32645@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=jrdr.linux@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lirongqing@baidu.com \
    --cc=mawilcox@microsoft.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).