From patchwork Tue Mar 26 16:47:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 10871613 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 CA62B13B5 for ; Tue, 26 Mar 2019 16:48:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAC9128D00 for ; Tue, 26 Mar 2019 16:48:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEDB228DB8; Tue, 26 Mar 2019 16:48:14 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33B9728D00 for ; Tue, 26 Mar 2019 16:48:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B1866B000E; Tue, 26 Mar 2019 12:48:10 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3650A6B028D; Tue, 26 Mar 2019 12:48:10 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2080D6B0290; Tue, 26 Mar 2019 12:48:10 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by kanga.kvack.org (Postfix) with ESMTP id EF67B6B000E for ; Tue, 26 Mar 2019 12:48:09 -0400 (EDT) Received: by mail-qt1-f197.google.com with SMTP id t22so13646330qtc.13 for ; Tue, 26 Mar 2019 09:48:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=iK/wmVZ8p1b2GI2LEEXxGPJxVgFfciFqYn5pD/bZPGQ=; b=qQ3tXePLJZhDHgDyzGXViQMchDEf2gJD8diXt9fmpBnYjf0HzuMVMJB1x5qEbW1sRx gC2Iak9PTiK3nrMPNGfO+hU/rSog/IOCIVhFt0YQw0wN3L9xpdjo9GZgalkjbMsNKqZI 2RrG5X3IHonxxUl5RgwVWs3naQaR/aDwK9PROZ3YXcWeYBgyXZaR0XZIdf4GfiD6BHGt NkHOCjRDCUJPbJSDpk5i7Ccl/T9JPx+QRrEyafLFYwYQnSl/vdAtQsvxjnwpBn0SjIS3 4VEuZ4g8rkiaHHb8MosQqWCUqjHCJekOdwcvQ7FUW8uKA0nJqKhPGSaJ3XTBELggdlht qS3Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAUsHNUaKYjTnDcB/31qvQ5Cf50GhvRJXa2CuW7M1icx/UvF2jqK e4YQ+enIid6J5Lkw3JMuGMky5xAtilJ2ZlMMiwVxDw0u/iLys0OWpF65DAJ9hufJDYATiNviCGS XMw4cFJNHXZczvTh7+2FPvAj5pkQIx8W1rnLnurwuQywT/rFeNxUx3AETIPh95unvgA== X-Received: by 2002:a37:47cb:: with SMTP id u194mr21246754qka.358.1553618889772; Tue, 26 Mar 2019 09:48:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXXwu6XoRAENNTbhTsKJ+pInu8HjSWBq8dOg0p3QJcmhpDtwenroUfazBizV1EGSWcSkoO X-Received: by 2002:a37:47cb:: with SMTP id u194mr21246718qka.358.1553618889177; Tue, 26 Mar 2019 09:48:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553618889; cv=none; d=google.com; s=arc-20160816; b=VBavY0Ru8Nbhrp6429rO+035Dt0yWfGx8zHgV7K3GxtRBalONVDFr1R7zIskAybYVN tQMSqTIn3eaj4mhcO4ueFskQOJ2uIKjDBXhaju9Rd+lejUlWt7L+AcKbcQrKfJZcz429 fdN2brTgmnDjFfMQTHLFRqWnWiFHumGfZ/nC7jBljoh1I5OSyBxD7tfH8w/Su0xRSqux U84PYJ0kCmGxaXdppziUhasOSuzVNlCDs05rWWPE/TOMXXRSNE5QI2vZCbI+ByI51rOO Ps/Sth95tXrAxxPNHVDxwGmS1rJ/Gd0cwPiiGv+VVwp0uo2gAq/y42B0ftMeFwW/OjHk daww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=iK/wmVZ8p1b2GI2LEEXxGPJxVgFfciFqYn5pD/bZPGQ=; b=iRL1m4/VHyPnHpw5AKukNAI6F7QHkR1wpcGkWRNf1QT11NEezngS3E3LrxILMZxQ9N ygmiPf+bxHpNVBQpVWwDjJO9yg9B/uUHijSD9zNwiYOp8NHeziY1B7VzlQ1K12CRcNcN BG/9Zxji86g+4UrlST6MasJtcB2mTrs4X/9xBrr6UXZRFExQR7tN1u4JXOJuE8L92iDu rPINbNYpF3muxZvFvV9+Is62LaSO9DIq7ESnmvpQodm4RPkv4VN21YteonFlxPc1+24G qzl5nyCRPGSfP/frYa0b8DHZZRr771lIMNYysuUEsQOeWUXQrFsonKDKUjLkNNpHM6b9 ECjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id z4si723381qvz.104.2019.03.26.09.48.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 09:48:09 -0700 (PDT) Received-SPF: pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3419485546; Tue, 26 Mar 2019 16:48:08 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.20.6.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10B7C17595; Tue, 26 Mar 2019 16:48:05 +0000 (UTC) From: jglisse@redhat.com To: linux-kernel@vger.kernel.org Cc: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Andrew Morton , linux-mm@kvack.org, =?utf-8?q?Ch?= =?utf-8?q?ristian_K=C3=B6nig?= , Joonas Lahtinen , Jani Nikula , Rodrigo Vivi , Jan Kara , Andrea Arcangeli , Peter Xu , Felix Kuehling , Jason Gunthorpe , Ross Zwisler , Dan Williams , Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , Michal Hocko , Ralph Campbell , John Hubbard , kvm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 3/8] mm/mmu_notifier: convert mmu_notifier_range->blockable to a flags Date: Tue, 26 Mar 2019 12:47:42 -0400 Message-Id: <20190326164747.24405-4-jglisse@redhat.com> In-Reply-To: <20190326164747.24405-1-jglisse@redhat.com> References: <20190326164747.24405-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 26 Mar 2019 16:48:08 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme Glisse Use an unsigned field for flags other than blockable and convert the blockable field to be one of those flags. Signed-off-by: Jérôme Glisse Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: Christian König Cc: Joonas Lahtinen Cc: Jani Nikula Cc: Rodrigo Vivi Cc: Jan Kara Cc: Andrea Arcangeli Cc: Peter Xu Cc: Felix Kuehling Cc: Jason Gunthorpe Cc: Andrew Morton Cc: Ross Zwisler Cc: Dan Williams Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Michal Hocko Cc: Christian Koenig Cc: Ralph Campbell Cc: John Hubbard Cc: kvm@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linux-rdma@vger.kernel.org Cc: Arnd Bergmann --- include/linux/mmu_notifier.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index e630def131ce..c8672c366f67 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -25,11 +25,13 @@ struct mmu_notifier_mm { spinlock_t lock; }; +#define MMU_NOTIFIER_RANGE_BLOCKABLE (1 << 0) + struct mmu_notifier_range { struct mm_struct *mm; unsigned long start; unsigned long end; - bool blockable; + unsigned flags; }; struct mmu_notifier_ops { @@ -229,7 +231,7 @@ extern void __mmu_notifier_invalidate_range(struct mm_struct *mm, static inline bool mmu_notifier_range_blockable(const struct mmu_notifier_range *range) { - return range->blockable; + return (range->flags & MMU_NOTIFIER_RANGE_BLOCKABLE); } static inline void mmu_notifier_release(struct mm_struct *mm) @@ -275,7 +277,7 @@ static inline void mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range) { if (mm_has_notifiers(range->mm)) { - range->blockable = true; + range->flags |= MMU_NOTIFIER_RANGE_BLOCKABLE; __mmu_notifier_invalidate_range_start(range); } } @@ -284,7 +286,7 @@ static inline int mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range) { if (mm_has_notifiers(range->mm)) { - range->blockable = false; + range->flags &= ~MMU_NOTIFIER_RANGE_BLOCKABLE; return __mmu_notifier_invalidate_range_start(range); } return 0; @@ -331,6 +333,7 @@ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, range->mm = mm; range->start = start; range->end = end; + range->flags = 0; } #define ptep_clear_flush_young_notify(__vma, __address, __ptep) \