From patchwork Mon Jan 21 07:57:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 10772793 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 90CD413BF for ; Mon, 21 Jan 2019 07:58:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81B0429D39 for ; Mon, 21 Jan 2019 07:58:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73FF429D3D; Mon, 21 Jan 2019 07:58:15 +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=ham 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 BC61629D39 for ; Mon, 21 Jan 2019 07:58:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4C658E0008; Mon, 21 Jan 2019 02:58:13 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E22768E0001; Mon, 21 Jan 2019 02:58:13 -0500 (EST) 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 D39398E0008; Mon, 21 Jan 2019 02:58:13 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id A84198E0001 for ; Mon, 21 Jan 2019 02:58:13 -0500 (EST) Received: by mail-qk1-f199.google.com with SMTP id z68so18616728qkb.14 for ; Sun, 20 Jan 2019 23:58:13 -0800 (PST) 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; bh=Rn84y8C8A09oYMyr3TKfoYKiYwkNmhvpkXr89LUWW7o=; b=pNvq4oe/x5iOPhMsfefSysM6NY9aU/svJiK8Gfx9p9KISk7IfYX/zQqrFdeotp9Fo8 OFzq9FMc2gSlEdv0cOZHshUVW3LqLRD3UV2NB1tgpYE4ScqNAYXfb8NCAkvV/EKDqKjz WZA3xmgL3B0MDo2OZFzFkn3KH1zM1qr8eXRVRqQ1wg2zP3tZ7O4RAYQ/UO6jsRdBCHlC tPs2XkDj+AF11+Rf5Sr6P+OCm6B7iwPPtuIivQ+ZqweYtzIQnvF1+w6T2p7hZVen3k3q 4XAp2UeBippgnbj0ezTsPHsyyC5TueuEJTyXjl3V7oVV9nDzmLgYkeYRkgeJrrfKIBwl hd+A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of peterx@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AJcUukfdJl0y4vzaSTedjWBdTLWrLbQz7nfLXdpf0zv4WApcdykadmJy jRJK/mYLLs1hJoVNuZe4sdelqjRFBcvM1MIatXnwadLbgzQxCOEIcVSU8ABRqNe+L8xb9plQWYg h9+/nIG9D+IHLpHI66AWN+gUC/POMVy0ngirpDENVMsMcQGGJvfZSnoJebRTSql3CpA== X-Received: by 2002:a0c:e394:: with SMTP id a20mr24243221qvl.42.1548057493462; Sun, 20 Jan 2019 23:58:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN4fFlqv5THU73viaWz59Bt33/71ufT3pMaob/Zux8tPEa9VqE0bn+ZLXn9L2BHdK2g4wRxT X-Received: by 2002:a0c:e394:: with SMTP id a20mr24243207qvl.42.1548057493063; Sun, 20 Jan 2019 23:58:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548057493; cv=none; d=google.com; s=arc-20160816; b=LoOIfAAUwVPEGbctsJ25z4OABXCtxahBBUUO8DIaHUo9d/hWz/5wDRCbr8nralpp5R 9Rtfjg6wbthxqHJ0zCOcnlRh/zR5jSb8tqgytWI7TkweSD/ueX4JiShT52gLNNX28rk8 TyWJt2kbn3yLf8ZnOkiGNdpv4GrKGTdWd8c0sNDiOaCOFoMHRDo10xL/U95GZEUph9Uu u9g3idmJdaWn1Kf5RuHlAH35Za6mwjYz5hc+dwLFWBKMqiaGuc9SRTIa9+8oQaYsmnNW nUGgDqHuKuSAU6MpR7RqJW3lWcgnb8+niW/khkI49vqpkEz3bSezL0fZjH0LbeeOXqKv wvaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=Rn84y8C8A09oYMyr3TKfoYKiYwkNmhvpkXr89LUWW7o=; b=AWMcg//rYWeEd1i8UluvYM9BYnPhtJPOwveXfxsM2rNDXYsHebX1/o+ZCEAr74FKmy DTzp8kXEUEjPi6pPnMm0M+j4sjyRocBTryYXF35zmG1WiNUzx3OFTwDKdgl/9nQ5isES voLG5tJ7IuLZzakXW3LJ8xrWYDB3fYn8LmlLhEb+R0rcUlASTkn4QshCSuoILPi33qQt 8MvJ9Q0rcDrSu1ljimbI23pnio9X6LN7nKsQEb41ROgTe4qfA49yjmA63wCu81OzwJZj xTi7gKC/TPX///M+wT4Fzf5RhZAeB7tztlHQJyd1saRWPuXWqiZAJG1EW2p6FLJo8ELx 3kEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of peterx@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=peterx@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 j13si932278qtj.296.2019.01.20.23.58.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Jan 2019 23:58:13 -0800 (PST) Received-SPF: pass (google.com: domain of peterx@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 peterx@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 268237F40E; Mon, 21 Jan 2019 07:58:12 +0000 (UTC) Received: from xz-x1.nay.redhat.com (dhcp-14-116.nay.redhat.com [10.66.14.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 746D3608C2; Mon, 21 Jan 2019 07:58:03 +0000 (UTC) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Hugh Dickins , Maya Gokhale , Jerome Glisse , Johannes Weiner , peterx@redhat.com, Martin Cracauer , Denis Plotnikov , Shaohua Li , Andrea Arcangeli , Pavel Emelyanov , Mike Kravetz , Marty McFadden , Mike Rapoport , Mel Gorman , "Kirill A . Shutemov" , "Dr . David Alan Gilbert" , Rik van Riel Subject: [PATCH RFC 05/24] userfaultfd: wp: add helper for writeprotect check Date: Mon, 21 Jan 2019 15:57:03 +0800 Message-Id: <20190121075722.7945-6-peterx@redhat.com> In-Reply-To: <20190121075722.7945-1-peterx@redhat.com> References: <20190121075722.7945-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 21 Jan 2019 07:58:12 +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: Shaohua Li add helper for writeprotect check. Will use it later. Cc: Andrea Arcangeli Cc: Pavel Emelyanov Cc: Rik van Riel Cc: Kirill A. Shutemov Cc: Mel Gorman Cc: Hugh Dickins Cc: Johannes Weiner Signed-off-by: Shaohua Li Signed-off-by: Andrea Arcangeli Signed-off-by: Peter Xu --- include/linux/userfaultfd_k.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h index 37c9eba75c98..38f748e7186e 100644 --- a/include/linux/userfaultfd_k.h +++ b/include/linux/userfaultfd_k.h @@ -50,6 +50,11 @@ static inline bool userfaultfd_missing(struct vm_area_struct *vma) return vma->vm_flags & VM_UFFD_MISSING; } +static inline bool userfaultfd_wp(struct vm_area_struct *vma) +{ + return vma->vm_flags & VM_UFFD_WP; +} + static inline bool userfaultfd_armed(struct vm_area_struct *vma) { return vma->vm_flags & (VM_UFFD_MISSING | VM_UFFD_WP); @@ -94,6 +99,11 @@ static inline bool userfaultfd_missing(struct vm_area_struct *vma) return false; } +static inline bool userfaultfd_wp(struct vm_area_struct *vma) +{ + return false; +} + static inline bool userfaultfd_armed(struct vm_area_struct *vma) { return false;