[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181205163520.GG30615@quack2.suse.cz>
Date: Wed, 5 Dec 2018 17:35:20 +0100
From: Jan Kara <jack@...e.cz>
To: jglisse@...hat.com
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Matthew Wilcox <mawilcox@...rosoft.com>,
Ross Zwisler <zwisler@...nel.org>, Jan Kara <jack@...e.cz>,
Dan Williams <dan.j.williams@...el.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Michal Hocko <mhocko@...nel.org>,
Christian Koenig <christian.koenig@....com>,
Felix Kuehling <felix.kuehling@....com>,
Ralph Campbell <rcampbell@...dia.com>,
John Hubbard <jhubbard@...dia.com>, kvm@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-rdma@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] mm/mmu_notifier: use structure for
invalidate_range_start/end callback
On Wed 05-12-18 00:36:26, jglisse@...hat.com wrote:
> diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
> index 5119ff846769..5f6665ae3ee2 100644
> --- a/mm/mmu_notifier.c
> +++ b/mm/mmu_notifier.c
> @@ -178,14 +178,20 @@ int __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
> unsigned long start, unsigned long end,
> bool blockable)
> {
> + struct mmu_notifier_range _range, *range = &_range;
Why these games with two variables?
> struct mmu_notifier *mn;
> int ret = 0;
> int id;
>
> + range->blockable = blockable;
> + range->start = start;
> + range->end = end;
> + range->mm = mm;
> +
Use your init function for this?
> id = srcu_read_lock(&srcu);
> hlist_for_each_entry_rcu(mn, &mm->mmu_notifier_mm->list, hlist) {
> if (mn->ops->invalidate_range_start) {
> - int _ret = mn->ops->invalidate_range_start(mn, mm, start, end, blockable);
> + int _ret = mn->ops->invalidate_range_start(mn, range);
> if (_ret) {
> pr_info("%pS callback failed with %d in %sblockable context.\n",
> mn->ops->invalidate_range_start, _ret,
> @@ -205,9 +211,20 @@ void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
> unsigned long end,
> bool only_end)
> {
> + struct mmu_notifier_range _range, *range = &_range;
> struct mmu_notifier *mn;
> int id;
>
> + /*
> + * The end call back will never be call if the start refused to go
> + * through because of blockable was false so here assume that we
> + * can block.
> + */
> + range->blockable = true;
> + range->start = start;
> + range->end = end;
> + range->mm = mm;
> +
The same as above.
Otherwise the patch looks good to me.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists