From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE904C4360F for ; Thu, 21 Feb 2019 18:07:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 997462084D for ; Thu, 21 Feb 2019 18:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728738AbfBUSHl (ORCPT ); Thu, 21 Feb 2019 13:07:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45988 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbfBUSHk (ORCPT ); Thu, 21 Feb 2019 13:07:40 -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 295C730058A8; Thu, 21 Feb 2019 18:07:40 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.236]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F0C1282C2; Thu, 21 Feb 2019 18:07:32 +0000 (UTC) Date: Thu, 21 Feb 2019 13:07:30 -0500 From: Jerome Glisse To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Hugh Dickins , Maya Gokhale , Pavel Emelyanov , Johannes Weiner , Martin Cracauer , Shaohua Li , Marty McFadden , Andrea Arcangeli , Mike Kravetz , Denis Plotnikov , Mike Rapoport , Mel Gorman , "Kirill A . Shutemov" , "Dr . David Alan Gilbert" Subject: Re: [PATCH v2 16/26] userfaultfd: wp: add pmd_swp_*uffd_wp() helpers Message-ID: <20190221180730.GP2813@redhat.com> References: <20190212025632.28946-1-peterx@redhat.com> <20190212025632.28946-17-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190212025632.28946-17-peterx@redhat.com> User-Agent: Mutt/1.10.0 (2018-05-17) 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.40]); Thu, 21 Feb 2019 18:07:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 12, 2019 at 10:56:22AM +0800, Peter Xu wrote: > Adding these missing helpers for uffd-wp operations with pmd > swap/migration entries. > > Signed-off-by: Peter Xu Reviewed-by: Jérôme Glisse > --- > arch/x86/include/asm/pgtable.h | 15 +++++++++++++++ > include/asm-generic/pgtable_uffd.h | 15 +++++++++++++++ > 2 files changed, 30 insertions(+) > > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h > index 6863236e8484..18a815d6f4ea 100644 > --- a/arch/x86/include/asm/pgtable.h > +++ b/arch/x86/include/asm/pgtable.h > @@ -1401,6 +1401,21 @@ static inline pte_t pte_swp_clear_uffd_wp(pte_t pte) > { > return pte_clear_flags(pte, _PAGE_SWP_UFFD_WP); > } > + > +static inline pmd_t pmd_swp_mkuffd_wp(pmd_t pmd) > +{ > + return pmd_set_flags(pmd, _PAGE_SWP_UFFD_WP); > +} > + > +static inline int pmd_swp_uffd_wp(pmd_t pmd) > +{ > + return pmd_flags(pmd) & _PAGE_SWP_UFFD_WP; > +} > + > +static inline pmd_t pmd_swp_clear_uffd_wp(pmd_t pmd) > +{ > + return pmd_clear_flags(pmd, _PAGE_SWP_UFFD_WP); > +} > #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_WP */ > > #define PKRU_AD_BIT 0x1 > diff --git a/include/asm-generic/pgtable_uffd.h b/include/asm-generic/pgtable_uffd.h > index 643d1bf559c2..828966d4c281 100644 > --- a/include/asm-generic/pgtable_uffd.h > +++ b/include/asm-generic/pgtable_uffd.h > @@ -46,6 +46,21 @@ static __always_inline pte_t pte_swp_clear_uffd_wp(pte_t pte) > { > return pte; > } > + > +static inline pmd_t pmd_swp_mkuffd_wp(pmd_t pmd) > +{ > + return pmd; > +} > + > +static inline int pmd_swp_uffd_wp(pmd_t pmd) > +{ > + return 0; > +} > + > +static inline pmd_t pmd_swp_clear_uffd_wp(pmd_t pmd) > +{ > + return pmd; > +} > #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_WP */ > > #endif /* _ASM_GENERIC_PGTABLE_UFFD_H */ > -- > 2.17.1 >