From patchwork Tue Mar 26 20:28:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13605072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BB11CD1283 for ; Tue, 26 Mar 2024 20:28:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2269A6B0095; Tue, 26 Mar 2024 16:28:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E69506B0096; Tue, 26 Mar 2024 16:28:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9884B6B0095; Tue, 26 Mar 2024 16:28:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 49FF06B0096 for ; Tue, 26 Mar 2024 16:28:40 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 23A941A036E for ; Tue, 26 Mar 2024 20:28:40 +0000 (UTC) X-FDA: 81940328400.20.51A9321 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf17.hostedemail.com (Postfix) with ESMTP id 7463D4000B for ; Tue, 26 Mar 2024 20:28:38 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=TfaZALBy; spf=none (imf17.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711484918; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sq9t5ZRvbstKnwCVhJax9lK120QpoDyuWhQ2hhEZpOI=; b=y6ysO5jKp6PemXb2z6cYez5X6GynvpuCbi8ij9nVp2RRrJ3M8BS6MLCnr/1W1xh2gwFTaV lkfkHZon6cePrqX6kfYgAgaI9btQN15q1hUzq7PHEKeRpR4cqNsOyBkXJPB8EviurhFV6X a689uDJhFQ96c9CvtXsBzFQxWHVTToU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711484918; a=rsa-sha256; cv=none; b=oZzlkmXh57IppTY6lzTtuLIrsGYiqAWgeHyhVljexytgtDjKoHayr3DI9gjU2vNWkoSR/K NKJJ/q3zbMURjSsigArukGipLYHJuUUJak7NcAj5mPn1949h+9cHk9UBzPyzdEvIfNcs7O GrjmYLCRA/rZdMRdJLhJnuZsW4plWsQ= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=TfaZALBy; spf=none (imf17.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=sq9t5ZRvbstKnwCVhJax9lK120QpoDyuWhQ2hhEZpOI=; b=TfaZALByTDUioW1NWYEi7Z5MnM WtGtgg3wa3J2iKinVs4P/po9H4jlJeZEVee8tBzsARkr+ZaPbu7DUYFYFjCuZ+NEUCLSmO+9XL7ez /drg9Y5wGoeldAAc1mHNz0j4dCARsuYO7QLHNlMm+ZmyR1tK9A8OXsbZVhr17QIqeamawjf8yyQDV KUIHZAA8rq561Ce3FTKga46lDsOoPLdrmO17AvE2Q4Qz9KSGEGN496oKh+svatmuANIvxoE06yiZL d1DymReEBQexBgB/PcBo5y86qCfcO1mw2HLoEQscbPkD7fWSepZLsLZdxFiqOcCRqEc4kTCQDlvT5 Ze6/hPDQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpDPR-00000002CGr-0S40; Tue, 26 Mar 2024 20:28:37 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 7/8] dax: Use huge_zero_folio Date: Tue, 26 Mar 2024 20:28:27 +0000 Message-ID: <20240326202833.523759-8-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240326202833.523759-1-willy@infradead.org> References: <20240326202833.523759-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7463D4000B X-Rspam-User: X-Stat-Signature: 6bchqdq4ecyia9huz1s8f49yn8ef9gec X-Rspamd-Server: rspam03 X-HE-Tag: 1711484918-602895 X-HE-Meta: U2FsdGVkX1+smH49bHtwkvWx0MJPFG4OCSvY3KsuYs3G3hn2n9kJtulvQQXzpPXmYfKrZjtlVWtVfXgXFkFaqY+NqNEYyLgBQGl8AOrKpSgpJ7roiejFHEroZjowtiTXXwsauhzl+ekz1iwY7JcTa695O3/6CzVjQpxm01JS3qbFC40udrlL389P1tRQjHLTXvwjPFubNeygZTdCRP6+XVrJL3KpRp3STiXxRKeFFf+dtzkfy1ITC8W6Y80ni5XWGKibNkxKQzcPHyvohfalXR3d7Y64Fje3NIygY4NbR8PRCopkDU3Naa0h6mVns+FntD3r6P89+Y7F7Qk984WH3ETHga+eKg2vgJ/DYPtcJL/A0lQG5EM8B57yB6cG72ZTMptRIciOtP6jIzs9sqheunOXN0VFpbioe4EUGTqsa71U1RT9VRtWEBuVETttkFeymJrBPvG9oGClno898YXVwXA4shgkJUVhF/FAFmg7haEUVnfbY201E/IWT9V+cDy0nsogCkGHhynrL/JCfHiBLWRCxPIo186789GM+7r3v+bqq+rq8TpkYTqXv1M/9xeJ86zE/BKetEzQZwp/BMr6nLpGXaNZyEnlF5G5a+D/YngOIx8ZBEl5fSqeIG9zWugxL8pn4Jszs6cBdh+ULXfWKIG1gZxmdx85H4uzXBXCcwl0ry6vziFjTVEEAsgJfU0GoD0HWCTkHRIuOXhdpwyoJPUOfsZioYvu0TzGLysWr356PBYepr4No2bs4gAa75rmqmjJNmP4WjcnwRCLpnkC+e8djC+CqZwe6czC0KK9CK6nbHUK8kMtj+iDMwPjG/5SYX5BQEUBBl4sLl8Gpy//0Yj5l0N3JFu+69/kWatoV5TmH3QSuLhOk8jRTkBiVeWUx/9o/TX1I6YJcPbvPDdXjkkUEe5s9Uss8RBQrUkhugmVhqGUTt9oQvI8ejYsguJAGvY7xeY7xnEywkFoS1f 2ZjFyZLg RwgBe9mZ/Kvrc4FQmDYI2EzYdUbYV4GKPKYsQVbUpK5GCmgcXulcEPRm+Ir1kiczOG8QHRupvULEoVNJkXOMnq23iaRQIB3XOGNN84Ba0XiEkn1gkS6t+7rW7qtpIp3+E4HYgtvjVfYcyHdXoaRSyY6u9ZMEM/voJ8EcbFw2PZcTWtGQ94Vga02+0qj/kGuA9NyvgZKJoV7rZ9ABVtZjwigI7LfgLHeyzV+LR X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Convert from huge_zero_page to huge_zero_folio. Signed-off-by: Matthew Wilcox (Oracle) --- fs/dax.c | 14 +++++++------- include/trace/events/fs_dax.h | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 423fc1607dfa..becb4a6920c6 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -1207,17 +1207,17 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf, struct vm_area_struct *vma = vmf->vma; struct inode *inode = mapping->host; pgtable_t pgtable = NULL; - struct page *zero_page; + struct folio *zero_folio; spinlock_t *ptl; pmd_t pmd_entry; pfn_t pfn; - zero_page = mm_get_huge_zero_page(vmf->vma->vm_mm); + zero_folio = mm_get_huge_zero_folio(vmf->vma->vm_mm); - if (unlikely(!zero_page)) + if (unlikely(!zero_folio)) goto fallback; - pfn = page_to_pfn_t(zero_page); + pfn = page_to_pfn_t(&zero_folio->page); *entry = dax_insert_entry(xas, vmf, iter, *entry, pfn, DAX_PMD | DAX_ZERO_PAGE); @@ -1237,17 +1237,17 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf, pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); mm_inc_nr_ptes(vma->vm_mm); } - pmd_entry = mk_pmd(zero_page, vmf->vma->vm_page_prot); + pmd_entry = mk_pmd(&zero_folio->page, vmf->vma->vm_page_prot); pmd_entry = pmd_mkhuge(pmd_entry); set_pmd_at(vmf->vma->vm_mm, pmd_addr, vmf->pmd, pmd_entry); spin_unlock(ptl); - trace_dax_pmd_load_hole(inode, vmf, zero_page, *entry); + trace_dax_pmd_load_hole(inode, vmf, zero_folio, *entry); return VM_FAULT_NOPAGE; fallback: if (pgtable) pte_free(vma->vm_mm, pgtable); - trace_dax_pmd_load_hole_fallback(inode, vmf, zero_page, *entry); + trace_dax_pmd_load_hole_fallback(inode, vmf, zero_folio, *entry); return VM_FAULT_FALLBACK; } #else diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h index 97b09fcf7e52..86fe6aecff1e 100644 --- a/include/trace/events/fs_dax.h +++ b/include/trace/events/fs_dax.h @@ -62,14 +62,14 @@ DEFINE_PMD_FAULT_EVENT(dax_pmd_fault_done); DECLARE_EVENT_CLASS(dax_pmd_load_hole_class, TP_PROTO(struct inode *inode, struct vm_fault *vmf, - struct page *zero_page, + struct folio *zero_folio, void *radix_entry), - TP_ARGS(inode, vmf, zero_page, radix_entry), + TP_ARGS(inode, vmf, zero_folio, radix_entry), TP_STRUCT__entry( __field(unsigned long, ino) __field(unsigned long, vm_flags) __field(unsigned long, address) - __field(struct page *, zero_page) + __field(struct folio *, zero_folio) __field(void *, radix_entry) __field(dev_t, dev) ), @@ -78,17 +78,17 @@ DECLARE_EVENT_CLASS(dax_pmd_load_hole_class, __entry->ino = inode->i_ino; __entry->vm_flags = vmf->vma->vm_flags; __entry->address = vmf->address; - __entry->zero_page = zero_page; + __entry->zero_folio = zero_folio; __entry->radix_entry = radix_entry; ), - TP_printk("dev %d:%d ino %#lx %s address %#lx zero_page %p " + TP_printk("dev %d:%d ino %#lx %s address %#lx zero_folio %p " "radix_entry %#lx", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->vm_flags & VM_SHARED ? "shared" : "private", __entry->address, - __entry->zero_page, + __entry->zero_folio, (unsigned long)__entry->radix_entry ) ) @@ -96,8 +96,8 @@ DECLARE_EVENT_CLASS(dax_pmd_load_hole_class, #define DEFINE_PMD_LOAD_HOLE_EVENT(name) \ DEFINE_EVENT(dax_pmd_load_hole_class, name, \ TP_PROTO(struct inode *inode, struct vm_fault *vmf, \ - struct page *zero_page, void *radix_entry), \ - TP_ARGS(inode, vmf, zero_page, radix_entry)) + struct folio *zero_folio, void *radix_entry), \ + TP_ARGS(inode, vmf, zero_folio, radix_entry)) DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole); DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole_fallback);