linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Jan H. Schönherr" <jschoenh@amazon.de>
Cc: Matthew Wilcox <mawilcox@microsoft.com>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] dax: Release PMD lock even when there is no PMD support in DAX
Date: Thu, 18 Jan 2018 06:22:07 -0800	[thread overview]
Message-ID: <20180118142207.GB28322@bombadil.infradead.org> (raw)
In-Reply-To: <20180118140739.GA28322@bombadil.infradead.org>

On Thu, Jan 18, 2018 at 06:07:39AM -0800, Matthew Wilcox wrote:
> On Thu, Jan 18, 2018 at 02:38:39PM +0100, Jan H. Sch�nherr wrote:
> > The function follow_pte_pmd() can theoretically return after having
> > acquired a PMD lock, even when DAX was not compiled with
> > CONFIG_FS_DAX_PMD.
> 
> I don't think it can.  How would a PMD entry get into a DAX VMA if we
> compiled the kernel without CONFIG_FS_DAX_PMD?

How about this patch instead?  Should shut up sparse nicely.

diff --git a/fs/dax.c b/fs/dax.c
index 78b72c48374e..fea1b64d111b 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -586,6 +586,12 @@ pgoff_address(pgoff_t pgoff, struct vm_area_struct *vma)
 	return address;
 }
 
+#ifdef CONFIG_FS_DAX_PMD
+#define dax_pmd(pmdp)	pmdp
+#else
+#define dax_pmd(pmdp)	0
+#endif
+
 /* Walk all mappings of a given index of a file and writeprotect them */
 static void dax_mapping_entry_mkclean(struct address_space *mapping,
 				      pgoff_t index, unsigned long pfn)
@@ -621,8 +627,7 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping,
 		 *
 		 * See Documentation/vm/mmu_notifier.txt
 		 */
-		if (pmdp) {
-#ifdef CONFIG_FS_DAX_PMD
+		if (dax_pmd(pmdp)) {
 			pmd_t pmd;
 
 			if (pfn != pmd_pfn(*pmdp))
@@ -638,7 +643,6 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping,
 			set_pmd_at(vma->vm_mm, address, pmdp, pmd);
 unlock_pmd:
 			spin_unlock(ptl);
-#endif
 		} else {
 			if (pfn != pte_pfn(*ptep))
 				goto unlock_pte;

  reply	other threads:[~2018-01-18 14:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 13:38 [PATCH] dax: Release PMD lock even when there is no PMD support in DAX Jan H. Schönherr
2018-01-18 14:07 ` Matthew Wilcox
2018-01-18 14:22   ` Matthew Wilcox [this message]
2018-01-18 14:27     ` Jan H. Schönherr
2018-01-18 14:35       ` Jan H. Schönherr
2018-01-18 14:22   ` Jan H. Schönherr
2018-01-18 16:20 ` Ross Zwisler
2018-01-25 16:34   ` Ross Zwisler
2018-01-25 21:29     ` Jan H. Schönherr

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=20180118142207.GB28322@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=jschoenh@amazon.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mawilcox@microsoft.com \
    --cc=ross.zwisler@linux.intel.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).