Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1366543ybi; Wed, 19 Jun 2019 19:23:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9dnx/tmMPkMOigP+DAeBZ4X6v1Pt32C2TX8BB07azwBq/Mn+pec4q1D28AL5oRmL+MW0J X-Received: by 2002:aa7:8188:: with SMTP id g8mr75633638pfi.221.1560997437119; Wed, 19 Jun 2019 19:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560997437; cv=none; d=google.com; s=arc-20160816; b=VltQ7w3YKlsb3f2f3nFoQkdsDfpbYeZ4K079ahrkgCq1MLnvhjL8QffPqMc4MGUh8M 1z4FggBVZcXNyirMEf8tByEmHkv8Fban7g2Q8eTkeJEvdx9GgLqe5BHSzOGDtZejavuD eCVfibamC/6TGdMpJNLJSiq64CKsEN/CHBgfXjJHeZ6wT19OpkPsfP4/QZSrD2ZLgCB/ p8rGqoFCsj3Bl2TtCILn5niww0LrFCiHSlNSDTTT2PvkgaBrGixDrnam89Zxtke+pF2X Bh0vVR1tChS4LG/PeI/W4pT+EUGVf4rhCsU1YAtWZiCVlaTZWn1HRRo8T+eezhrHTcyy UwEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RJusdW+a9mihYhTYjKehRlZ9xNq8p5VU2+XjeF7nXj4=; b=uduntYE1zo1CwRvH6X5DxNhMzokFgOTEFM1yBNeWCrPTgLm02wuJApXjnsuBTMJl4S z7vSz2+eUbElhn6v/hEAmIIlcX7MWr7RGMsDBQ4IOmLTblYBywpxWPA2Z+DUCQheTK+t S1nNULTrP/05oEhEI926tMM2ze38DxUcHY9jJ6s+KJWrdXFXL17PGoERNQhGaIdNlBAm +8bxL3MKpm/4BW1a3JH9/phMFL3Iavh6rwtjMsWa5CygfDkp49n7rFpNwLExyo6kT8zi fF8R55I0SBLbVfENrF3ofPIxMxWdKKWU3hByx3nVA7qD8RfE4FBT71QiZ2ZY5OIfYy/7 FyTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si16468950plr.364.2019.06.19.19.23.41; Wed, 19 Jun 2019 19:23:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731307AbfFTCVo (ORCPT + 99 others); Wed, 19 Jun 2019 22:21:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43240 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726480AbfFTCVn (ORCPT ); Wed, 19 Jun 2019 22:21:43 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5EC3B3079B86; Thu, 20 Jun 2019 02:21:43 +0000 (UTC) Received: from xz-x1.redhat.com (ovpn-12-78.pek2.redhat.com [10.72.12.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id B29151001E6F; Thu, 20 Jun 2019 02:21:28 +0000 (UTC) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Hugh Dickins , Maya Gokhale , Jerome Glisse , Pavel Emelyanov , Johannes Weiner , peterx@redhat.com, Martin Cracauer , Denis Plotnikov , Shaohua Li , Andrea Arcangeli , Mike Kravetz , Marty McFadden , Mike Rapoport , Mel Gorman , "Kirill A . Shutemov" , "Dr . David Alan Gilbert" , Pavel Emelyanov , Rik van Riel Subject: [PATCH v5 06/25] userfaultfd: wp: add helper for writeprotect check Date: Thu, 20 Jun 2019 10:19:49 +0800 Message-Id: <20190620022008.19172-7-peterx@redhat.com> In-Reply-To: <20190620022008.19172-1-peterx@redhat.com> References: <20190620022008.19172-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 20 Jun 2019 02:21:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Jerome Glisse Reviewed-by: Mike Rapoport 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 ac9d71e24b81..5dc247af0f2e 100644 --- a/include/linux/userfaultfd_k.h +++ b/include/linux/userfaultfd_k.h @@ -52,6 +52,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); @@ -96,6 +101,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; -- 2.21.0