Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp193777imm; Tue, 18 Sep 2018 19:48:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaeTlHxneYHA6nPGYsIhDqPz2uGKueIQ5tWEEvB7UkTDn2XfVT8JTQaYQ5J2rMQJvC++nPs X-Received: by 2002:a63:ff1f:: with SMTP id k31-v6mr29511561pgi.20.1537325305615; Tue, 18 Sep 2018 19:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537325305; cv=none; d=google.com; s=arc-20160816; b=jr8WXvMgf92A+/K99Mx1q3eELfUTdbbZVScUfr7Pvs2qucUUHR12cmQbEFSzOcpMlL SsQTA3PewzMOorTOE69cQCEl8E+FAZZNZg3yvasw5KI+/xx+Qr+Nfo7GLhcXitH2AFPh un2mJ+ymakdCJOKubzfnl7C0DWLYAKUqRJhkrTxQTld+6drSUffGLl78A1vq+t+oB9bn dnMYDGwdEqD84z0InObrYQVliG0Lwns5UwTyS3oQiAiwzfRls5lDe1CK3J6YGeeNeIJD SdC/AnycyRvgssWyW95BMjiskrR9fiwj6/2Zy6x+zJh6spxHELt/SgAsKEtkXuZzJgUt h1og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=HOn4suJH3GAoYX6RZWnq5eBR6SfCGFTKda6pMdr7ze0=; b=Mpqr8o/leZSiCqcbezeX/Kl16UZzQd12twfxnSHVcPSNb+bT5yZoYfkGd8TEwph/vT ubj63ugicPyyXKRxOTmB5wB3jkaQYl7SUISHPweGAz4d452S+v4718ZlM/6RRZj0Myj/ IfQt5Ripdo0Pg+nz2Lb15s7rAxNx3y2xJg8+Sn1NET3n5kZkr6Y+1RPz4b9emEopAqL8 6I3JfCf+vS35v8t3qw+l4feeULZviJr1JJPRdHPixiOd8XB2Zjft18+FrDmXmP1n5VDZ wF4ZAqAdSz4zAt92NZipGbf82KzSY6zQS+JrAlGKU+yoZRUploOR0VW0FNp4ABo54JAM KLpA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18-v6si19567821pfn.317.2018.09.18.19.48.10; Tue, 18 Sep 2018 19:48:25 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727730AbeISIXn (ORCPT + 99 others); Wed, 19 Sep 2018 04:23:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48256 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbeISIXn (ORCPT ); Wed, 19 Sep 2018 04:23:43 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 257BE34C9; Wed, 19 Sep 2018 02:48:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06FF81001F56; Wed, 19 Sep 2018 02:48:03 +0000 (UTC) Received: from zmail21.collab.prod.int.phx2.redhat.com (zmail21.collab.prod.int.phx2.redhat.com [10.5.83.24]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8F4A44BB74; Wed, 19 Sep 2018 02:48:02 +0000 (UTC) Date: Tue, 18 Sep 2018 22:48:02 -0400 (EDT) From: Pankaj Gupta To: Zhang Yi Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, pbonzini@redhat.com, dan j williams , dave jiang , yu c zhang , david@redhat.com, jack@suse.cz, hch@lst.de, linux-mm@kvack.org, rkrcmar@redhat.com, jglisse@redhat.com, yi z zhang Message-ID: <373427884.13987814.1537325282516.JavaMail.zimbra@redhat.com> In-Reply-To: <044309496afbb4121447dff6a453bd6b96d6068d.1534934405.git.yi.z.zhang@linux.intel.com> References: <044309496afbb4121447dff6a453bd6b96d6068d.1534934405.git.yi.z.zhang@linux.intel.com> Subject: Re: [PATCH V4 3/4] mm: add a function to differentiate the pages is from DAX device memory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.116.79, 10.4.195.12] Thread-Topic: add a function to differentiate the pages is from DAX device memory Thread-Index: ebQHsnixA0QSUk8WEmIsX4j9TyKNWg== X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 19 Sep 2018 02:48:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > DAX driver hotplug the device memory and move it to memory zone, these > pages will be marked reserved flag, however, some other kernel componet > will misconceive these pages are reserved mmio (ex: we map these dev_dax > or fs_dax pages to kvm for DIMM/NVDIMM backend). Together with the type > MEMORY_DEVICE_FS_DAX, we can use is_dax_page() to differentiate the pages > is DAX device memory or not. > > Signed-off-by: Zhang Yi > Signed-off-by: Zhang Yu > Acked-by: Jan Kara > --- > include/linux/mm.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 68a5121..de5cbc3 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -889,6 +889,13 @@ static inline bool is_device_public_page(const struct > page *page) > page->pgmap->type == MEMORY_DEVICE_PUBLIC; > } > > +static inline bool is_dax_page(const struct page *page) > +{ > + return is_zone_device_page(page) && > + (page->pgmap->type == MEMORY_DEVICE_FS_DAX || > + page->pgmap->type == MEMORY_DEVICE_DEV_DAX); > +} > + > #else /* CONFIG_DEV_PAGEMAP_OPS */ > static inline void dev_pagemap_get_ops(void) > { > @@ -912,6 +919,11 @@ static inline bool is_device_public_page(const struct > page *page) > { > return false; > } > + > +static inline bool is_dax_page(const struct page *page) > +{ > + return false; > +} > #endif /* CONFIG_DEV_PAGEMAP_OPS */ > > static inline void get_page(struct page *page) > -- Reviewed-by: Pankaj Gupta > 2.7.4 > >