From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:54564 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbeHTUyy (ORCPT ); Mon, 20 Aug 2018 16:54:54 -0400 Date: Mon, 20 Aug 2018 10:38:16 -0700 From: Matthew Wilcox Subject: Re: [PATCH] mm: introduce kvvirt_to_page() helper Message-ID: <20180820173816.GE25153@bombadil.infradead.org> References: <1534596541-31393-1-git-send-email-lirongqing@baidu.com> <20180820144116.GO29735@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180820144116.GO29735@dhcp22.suse.cz> Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: Michal Hocko Cc: Li RongQing , Andrew Morton , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, "Kirill A. Shutemov" , Matthew Wilcox , Souptick Joarder , darrick.wong@oracle.com On Mon, Aug 20, 2018 at 04:41:16PM +0200, Michal Hocko wrote: > > +++ b/fs/xfs/xfs_buf.c > > for (i = 0; i < bp->b_page_count; i++) { > > - bp->b_pages[i] = mem_to_page((void *)pageaddr); > > + bp->b_pages[i] = kvvirt_to_page((void *)pageaddr); > > pageaddr += PAGE_SIZE; This wants mem_range_to_page_array(). > > +++ b/net/9p/trans_virtio.c > > for (index = 0; index < nr_pages; index++) { > > - if (is_vmalloc_addr(p)) > > - (*pages)[index] = vmalloc_to_page(p); > > - else > > - (*pages)[index] = kmap_to_page(p); > > + (*pages)[index] = kvvirt_to_page(p); Also mem_range_to_page_array(). > > +++ b/net/ceph/crypto.c > > @@ -191,11 +191,7 @@ static int setup_sgtable(struct sg_table *sgt, struct scatterlist *prealloc_sg, > > struct page *page; > > unsigned int len = min(chunk_len - off, buf_len); > > > > - if (is_vmalloc) > > - page = vmalloc_to_page(buf); > > - else > > - page = virt_to_page(buf); > > - > > + page = kvvirt_to_page(buf); > > sg_set_page(sg, page, len, off); > > > > off = 0; This whole function wants to move into the core and be called something like sg_alloc_table_from_virt(). > > +++ b/net/packet/af_packet.c > > @@ -374,15 +367,15 @@ static void __packet_set_status(struct packet_sock *po, void *frame, int status) > > switch (po->tp_version) { > > case TPACKET_V1: > > h.h1->tp_status = status; > > - flush_dcache_page(pgv_to_page(&h.h1->tp_status)); > > + flush_dcache_page(kvvirt_to_page(&h.h1->tp_status)); This driver really wants flush_dcache_range(start, len).