Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbbLHSan (ORCPT ); Tue, 8 Dec 2015 13:30:43 -0500 Received: from www.sr71.net ([198.145.64.142]:51533 "EHLO blackbird.sr71.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751919AbbLHSal (ORCPT ); Tue, 8 Dec 2015 13:30:41 -0500 Subject: Re: [PATCH 16/34] x86, mm: simplify get_user_pages() PTE bit handling To: Thomas Gleixner References: <20151204011424.8A36E365@viggo.jf.intel.com> <20151204011446.DDC6435F@viggo.jf.intel.com> Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, dave.hansen@linux.intel.com From: Dave Hansen Message-ID: <566721CE.1060800@sr71.net> Date: Tue, 8 Dec 2015 10:30:38 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 819 Lines: 32 On 12/08/2015 10:01 AM, Thomas Gleixner wrote: > static inline int pte_allows_gup(unsigned long pteval, int write) > { > unsigned long mask = _PAGE_PRESENT|_PAGE_USER; > > if (write) > mask |= _PAGE_RW; > > if ((pteval & mask) != mask) > return 0; > > if (!__pkru_allows_pkey(pte_flags_pkey(pteval), write)) > return 0; > return 1; > } > > and at the callsites do: > > if (pte_allows_gup(pte_val(pte, write)) > > if (pte_allows_gup(pmd_val(pmd, write)) > > if (pte_allows_gup(pud_val(pud, write)) > > Hmm? Looks fine to me. I'll do that. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/