From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f197.google.com (mail-wr0-f197.google.com [209.85.128.197]) by kanga.kvack.org (Postfix) with ESMTP id AD8BE6B0003 for ; Thu, 15 Mar 2018 13:41:02 -0400 (EDT) Received: by mail-wr0-f197.google.com with SMTP id x8so4215041wrg.14 for ; Thu, 15 Mar 2018 10:41:02 -0700 (PDT) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id x9si2423206edk.414.2018.03.15.10.41.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 10:41:01 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2FHel0b092766 for ; Thu, 15 Mar 2018 13:40:58 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gqv53v1k6-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 15 Mar 2018 13:40:53 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Mar 2018 17:40:13 -0000 Date: Thu, 15 Mar 2018 10:39:59 -0700 From: Ram Pai Subject: Re: [PATCH v3] x86: treat pkey-0 special Reply-To: Ram Pai References: <1521061214-22385-1-git-send-email-linuxram@us.ibm.com> <20180315172129.GD1060@ram.oc3035372033.ibm.com> <2bf8e659-5a8d-a2d5-ea52-e4d395ea2201@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2bf8e659-5a8d-a2d5-ea52-e4d395ea2201@intel.com> Message-Id: <20180315173959.GE1060@ram.oc3035372033.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: Dave Hansen Cc: Thomas Gleixner , mingo@redhat.com, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, ebiederm@xmission.com, corbet@lwn.net, arnd@arndb.de, fweimer@redhat.com, msuchanek@suse.com, Ulrich.Weigand@de.ibm.com On Thu, Mar 15, 2018 at 10:31:51AM -0700, Dave Hansen wrote: > On 03/15/2018 10:21 AM, Ram Pai wrote: > > On Thu, Mar 15, 2018 at 08:55:31AM -0700, Dave Hansen wrote: > >> On 03/15/2018 02:46 AM, Thomas Gleixner wrote: > >>>> + if (!pkey || !mm_pkey_is_allocated(mm, pkey)) > >>> Why this extra check? mm_pkey_is_allocated(mm, 0) should not return true > >>> ever. If it does, then this wants to be fixed. > >> I was thinking that we _do_ actually want it to seem allocated. It just > >> get "allocated" implicitly when an mm is created. I think that will > >> simplify the code if we avoid treating it specially in as many places as > >> possible. > > I think, the logic that makes pkey-0 special must to go > > in arch-neutral code. How about checking for pkey-0 in sys_pkey_free() > > itself? > > This is for protection against shooting yourself in the foot? Yes, that > can go in sys_pkey_free(). > > Does this need manpage and/or selftests updates? Yes. it needs selftest, manpage and documentation updates too. Unfortunately I am not getting enough reviewed-by for my selftests and documentation changes. :-( Need help! -- Ram Pai