From patchwork Thu Jan 31 18:37:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 10791175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3450139A for ; Thu, 31 Jan 2019 18:37:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCB103110C for ; Thu, 31 Jan 2019 18:37:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0FAA3113C; Thu, 31 Jan 2019 18:37:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86D6A3110C for ; Thu, 31 Jan 2019 18:37:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728045AbfAaShk (ORCPT ); Thu, 31 Jan 2019 13:37:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43976 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727882AbfAaShS (ORCPT ); Thu, 31 Jan 2019 13:37:18 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B0E99090D; Thu, 31 Jan 2019 18:37:18 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.20.6.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6934718506; Thu, 31 Jan 2019 18:37:17 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Andrea Arcangeli , Peter Xu , Andrew Morton , Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org Subject: [RFC PATCH 2/4] mm/mmu_notifier: use unsigned for event field in range struct Date: Thu, 31 Jan 2019 13:37:04 -0500 Message-Id: <20190131183706.20980-3-jglisse@redhat.com> In-Reply-To: <20190131183706.20980-1-jglisse@redhat.com> References: <20190131183706.20980-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 31 Jan 2019 18:37:18 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme Glisse Use unsigned for event field in range struct so that we can also set flags with the event. This patch change the field and introduce the helper. Signed-off-by: Jérôme Glisse Cc: Andrea Arcangeli Cc: Peter Xu Cc: Andrew Morton Cc: Paolo Bonzini Cc: Radim Krčmář Cc: kvm@vger.kernel.org --- include/linux/mmu_notifier.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index be873c431886..d7a35975c2bd 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -6,6 +6,7 @@ #include #include #include +#include struct mmu_notifier; struct mmu_notifier_ops; @@ -38,8 +39,11 @@ enum mmu_notifier_event { MMU_NOTIFY_PROTECTION_VMA, MMU_NOTIFY_PROTECTION_PAGE, MMU_NOTIFY_SOFT_DIRTY, + MMU_NOTIFY_EVENT_MAX }; +#define MMU_NOTIFIER_EVENT_BITS order_base_2(MMU_NOTIFY_EVENT_MAX) + #ifdef CONFIG_MMU_NOTIFIER /* @@ -60,7 +64,7 @@ struct mmu_notifier_range { struct mm_struct *mm; unsigned long start; unsigned long end; - enum mmu_notifier_event event; + unsigned event; bool blockable; }; @@ -352,7 +356,7 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, - enum mmu_notifier_event event, + unsigned event, struct vm_area_struct *vma, struct mm_struct *mm, unsigned long start,