Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4151512imm; Mon, 20 Aug 2018 10:40:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzxtKiWu/hqPBxnmA7GwV9hxQuWFAKE185N/PtF0kRjCYk3ymDplGcgCqPLWzQygE4WnvOX X-Received: by 2002:a63:788b:: with SMTP id t133-v6mr43949290pgc.329.1534786815375; Mon, 20 Aug 2018 10:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534786815; cv=none; d=google.com; s=arc-20160816; b=HoBycDEqdA2eEOBNjbbDz4J52+kr2PF2Y27t+j0xgmkcFaDHdC41hFTVfvCB5zcv9v N6jzjPqxIx7rb60h4LZwACom96Ywk+W39+hstVeO1VA38EeqxlyyZ3euAhmzb8of/yNd 0dXgcSxpsS88u+r/eL1w8vK4ioAYanRfo8ZAQdtgjQ4lcA7Duw8XEPnKaImNWYq0pEtR BZIzWGbkHFoKiKmwKavbMuxWPWnIymgjmX5u6CsJZ9Mro7EbTIoeUiHvSYQc7ddtq8QF ZMvBXKO+2FoM2f4Bhen9NQQedD0fer8AuxW0vTECEj7FlTYTTPKSoJEFb4iftSSKPr3j 9lKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=F1exH5Db5+aeTEyDC+TqDtSbmkMvRkI3VFGQ5caxwxk=; b=UN008Nd7KeNB94UkKIsNMhTd7LcsYHNQrFUhfLvbeCLDB7mOggG1T+4eJoYhwzNg/O T23rJZ1FRIbs2Q0L3XH6hyUF678wbF7kZfOnrn1f3r0qpH8E9I/0mtJ1U50lxZ3MshQR f8XvMY8fM5pY+ipLrkNgLlqn6m7jNhDyMI3+dIJy0BXBG3UhAZZYQovRZhlfJjCYf3XC ja8QePaX3qJInUn5tIByCVyQTTQAIIHYXoJk2VMX1XXceJz3bRQJ+YzBF7vu45aGSt6J CmK4GDYztywGfVcLW/0r4OMdWXWnlrprMD9iQzUpxwjmVkPmUasSUq5KwhFCJCRXPZNy Mj7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WKzOsk5n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d26-v6si10214484pgd.32.2018.08.20.10.40.00; Mon, 20 Aug 2018 10:40:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WKzOsk5n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726549AbeHTUyy (ORCPT + 99 others); Mon, 20 Aug 2018 16:54:54 -0400 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 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=F1exH5Db5+aeTEyDC+TqDtSbmkMvRkI3VFGQ5caxwxk=; b=WKzOsk5nikKhsIveUOgBD6hcm SCE794xpA92Iq5RS7sE2/PtF/S9YoTsPNuqV4HzZyPqvOEilRfv3FAAv5rK3KHQjYWqz3k5pQzv/9 Pc9+R8G204W99AsSagF9J1nAdPnBedsuF8EyLGVjvmW3OLrFlOQRN0fxHHtQUHG93YgKgCemMtytI WpQExkhCdwl8u2L9tZbM3C0iRZayw8iHAjDha2kgA5/4cF/FztC0HNMGd3urLpLUDGXqev1IZUpsk kTdyjbcFRegctSXsz2cMzBtHGWyA5u8M0AJiwaY7HvqXxzW3X40ILhZZ1xlANs1qd4cK3HS9f8bE2 b18lzRi4w==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fro88-0004Kf-O9; Mon, 20 Aug 2018 17:38:16 +0000 Date: Mon, 20 Aug 2018 10:38:16 -0700 From: Matthew Wilcox 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 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> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).