From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 45ED06B0033 for ; Wed, 13 Dec 2017 04:35:20 -0500 (EST) Received: by mail-pf0-f199.google.com with SMTP id 73so1471370pfz.11 for ; Wed, 13 Dec 2017 01:35:20 -0800 (PST) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0078.outbound.protection.outlook.com. [104.47.42.78]) by mx.google.com with ESMTPS id 94si617334ple.413.2017.12.13.01.35.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Dec 2017 01:35:19 -0800 (PST) Subject: Re: [patch 1/2] mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks References: <20171212200542.GJ5848@hpe.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Wed, 13 Dec 2017 10:34:59 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes , Dimitri Sivanich Cc: Andrew Morton , Michal Hocko , Andrea Arcangeli , Benjamin Herrenschmidt , Paul Mackerras , Oded Gabbay , Alex Deucher , David Airlie , Joerg Roedel , Doug Ledford , Jani Nikula , Mike Marciniszyn , Sean Hefty , Dimitri Sivanich , Boris Ostrovsky , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, linux-mm@kvack.org Am 12.12.2017 um 22:28 schrieb David Rientjes: > On Tue, 12 Dec 2017, Dimitri Sivanich wrote: > >>> --- a/drivers/misc/sgi-gru/grutlbpurge.c >>> +++ b/drivers/misc/sgi-gru/grutlbpurge.c >>> @@ -298,6 +298,7 @@ struct gru_mm_struct *gru_register_mmu_notifier(void) >>> return ERR_PTR(-ENOMEM); >>> STAT(gms_alloc); >>> spin_lock_init(&gms->ms_asid_lock); >>> + gms->ms_notifier.flags = 0; >>> gms->ms_notifier.ops = &gru_mmuops; >>> atomic_set(&gms->ms_refcnt, 1); >>> init_waitqueue_head(&gms->ms_wait_queue); >>> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c >> There is a kzalloc() just above this: >> gms = kzalloc(sizeof(*gms), GFP_KERNEL); >> >> Is that not sufficient to clear the 'flags' field? >> > Absolutely, but whether it is better to explicitly document that the mmu > notifier has cleared flags, i.e. there are no blockable callbacks, is > another story. I can change it if preferred. Actually I would invert the new flag, in other words specify that an MMU notifier will never sleep. The first reason is that we have 8 blocking notifiers and 5 not blocking if I counted right. So it is actually more common to sleep than not to. The second reason is to be conservative and assume the worst, e.g. that the flag is forgotten when a new notifier is added. Regards, Christian. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org