From: Jerome Glisse <jglisse@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-mm@kvack.org, "Andrew Morton" <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
"Matthew Wilcox" <mawilcox@microsoft.com>,
"Ross Zwisler" <zwisler@kernel.org>,
"Dan Williams" <dan.j.williams@intel.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Michal Hocko" <mhocko@kernel.org>,
"Christian Koenig" <christian.koenig@amd.com>,
"Felix Kuehling" <felix.kuehling@amd.com>,
"Ralph Campbell" <rcampbell@nvidia.com>,
"John Hubbard" <jhubbard@nvidia.com>,
kvm@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-rdma@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/3] mm/mmu_notifier: use structure for invalidate_range_start/end calls
Date: Wed, 5 Dec 2018 10:53:57 -0500 [thread overview]
Message-ID: <20181205155357.GA3536@redhat.com> (raw)
In-Reply-To: <20181205110416.GE22304@quack2.suse.cz>
On Wed, Dec 05, 2018 at 12:04:16PM +0100, Jan Kara wrote:
> Hi Jerome!
>
> On Mon 03-12-18 15:18:16, jglisse@redhat.com wrote:
> > From: Jérôme Glisse <jglisse@redhat.com>
> >
> > To avoid having to change many call sites everytime we want to add a
> > parameter use a structure to group all parameters for the mmu_notifier
> > invalidate_range_start/end cakks. No functional changes with this
> > patch.
>
> Two suggestions for the patch below:
>
> > @@ -772,7 +775,8 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index,
> > * call mmu_notifier_invalidate_range_start() on our behalf
> > * before taking any lock.
> > */
> > - if (follow_pte_pmd(vma->vm_mm, address, &start, &end, &ptep, &pmdp, &ptl))
> > + if (follow_pte_pmd(vma->vm_mm, address, &range,
> > + &ptep, &pmdp, &ptl))
> > continue;
>
> The change of follow_pte_pmd() arguments looks unexpected. Why should that
> care about mmu notifier range? I see it may be convenient but it doesn't look
> like a good API to me.
Saddly i do not see a way around that one this is because of fs/dax.c
which does the mmu_notifier_invalidate_range_end while follow_pte_pmd
do the mmu_notifier_invalidate_range_start
follow_pte_pmd does adjust the start and end address so that the dax
function does not have the logic to find those address. So instead of
duplicating that follow_pte_pmd inside the dax code i rather passed
around the range struct to follow_pte_pmd.
>
> > @@ -1139,11 +1140,15 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
> > downgrade_write(&mm->mmap_sem);
> > break;
> > }
> > - mmu_notifier_invalidate_range_start(mm, 0, -1);
> > +
> > + range.start = 0;
> > + range.end = -1UL;
> > + range.mm = mm;
> > + mmu_notifier_invalidate_range_start(&range);
>
> Also how about providing initializer for struct mmu_notifier_range? Or
> something like DECLARE_MMU_NOTIFIER_RANGE? That will make sure that
> unused arguments for particular notification places have defined values and
> also if you add another mandatory argument (like you do in your third
> patch), you just add another argument to the initializer and that way
> the compiler makes sure you haven't missed any place. Finally the code will
> remain more compact that way (less lines needed to initialize the struct).
That is what i do in v2 :)
Thank you for looking to all this.
Cheers,
Jérôme
next prev parent reply other threads:[~2018-12-05 15:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 20:18 [PATCH 0/3] mmu notifier contextual informations jglisse
2018-12-03 20:18 ` [PATCH 1/3] mm/mmu_notifier: use structure for invalidate_range_start/end callback jglisse
2018-12-03 20:18 ` [PATCH 2/3] mm/mmu_notifier: use structure for invalidate_range_start/end calls jglisse
2018-12-04 0:09 ` Jerome Glisse
2018-12-05 11:04 ` Jan Kara
2018-12-05 15:53 ` Jerome Glisse [this message]
2018-12-05 16:28 ` Jan Kara
2018-12-06 20:31 ` kbuild test robot
2018-12-06 20:35 ` kbuild test robot
2018-12-03 20:18 ` [PATCH 3/3] mm/mmu_notifier: contextual information for event triggering invalidation jglisse
2018-12-04 8:17 ` Mike Rapoport
2018-12-04 14:48 ` Jerome Glisse
2018-12-04 23:21 ` Andrew Morton
2018-12-06 20:53 ` kbuild test robot
2018-12-06 21:19 ` kbuild test robot
2018-12-06 21:51 ` Jerome Glisse
2018-12-04 7:35 ` [PATCH 0/3] mmu notifier contextual informations Koenig, Christian
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=20181205155357.GA3536@redhat.com \
--to=jglisse@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=christian.koenig@amd.com \
--cc=dan.j.williams@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
--cc=jack@suse.cz \
--cc=jhubbard@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mawilcox@microsoft.com \
--cc=mhocko@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rcampbell@nvidia.com \
--cc=rkrcmar@redhat.com \
--cc=zwisler@kernel.org \
/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).