Received: by 10.213.65.68 with SMTP id h4csp88983imn; Thu, 15 Mar 2018 10:22:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELs6l8UZsmhqKaHQbB3Q+gxWwjBiJvii1qVGemMV+xBFHsDxVKnhSi8ce/A1BhKFXmerLfXP X-Received: by 10.99.6.198 with SMTP id 189mr7431510pgg.131.1521134579238; Thu, 15 Mar 2018 10:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521134579; cv=none; d=google.com; s=arc-20160816; b=e0gihZ4aru4kdh5eUsYI/uX/d1ogUGL81X/bu/HZ8HQj6hwDuz8Tt2BcYZjwMASKMQ ZeOlhYd9DykRE6/gAB4FcSTu5G8capHwGY2a/U8NLIyDIlKc4FPrn7aNi8tWpmW7TWqh bDhemQOhhnTYGxaOBV0XRMEZkwebeV43r1BD+mNK2XoBCGAsLeD/5ZyH0K5do32BGjfl ZakBZKPOqIvUt2ZztdWAfIw2fVgomIXwE2q/U5J6D8YYhHJ9p3o3a78p7Jn00Hg3OhHg 8QKHuglTSuT3xbPaSagP3lCk+YUBERZvzpbd2VmwOSNqEsM+aZNsUIBF2bNFVpf28K6b SejA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=1diSOo+I/GEDDZodLuQ8cuMDTPIXl5bM9qCFKChmZTw=; b=KWDcelrDdONjgVjFBDieKUfcdghCsfyMYHm4JUUjjQvAHtVRGE5VWHCI4sNoCgs8u6 dOBBm905Y84guOxcXNXRvQE6gXLF2iFfm70yiH91zoZvLd4tYD4fsXmbbu/Cm0zopHFN lBQqkcfXukpscRizErpZc9TnJjImcnPo9gozEbtzWFjvckJPWDqTKreK1e1/K8QVZSth GkMpqSrketvqXsrhKbcoHHli41prxvp4Dr2gs7GFbS6z0XuVaIjHBa0AqAhNiIvuozGt RuwjXOYLnTpx/WJdbfBe2IVOj62QPor74sVX49Q3zbyJQjMJEvPZeNNjsxgFdINh7VmF 84Bw== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h70si4094276pfc.269.2018.03.15.10.22.44; Thu, 15 Mar 2018 10:22:59 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751969AbeCORVt (ORCPT + 99 others); Thu, 15 Mar 2018 13:21:49 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36184 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbeCORVr (ORCPT ); Thu, 15 Mar 2018 13:21:47 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2FHKYtJ104091 for ; Thu, 15 Mar 2018 13:21:47 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gqu377c4d-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 15 Mar 2018 13:21:46 -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:21:44 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 15 Mar 2018 17:21:38 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2FHLbm152887794; Thu, 15 Mar 2018 17:21:37 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4792E4C04A; Thu, 15 Mar 2018 17:14:51 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 768744C040; Thu, 15 Mar 2018 17:14:46 +0000 (GMT) Received: from ram.oc3035372033.ibm.com (unknown [9.85.168.17]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 15 Mar 2018 17:14:46 +0000 (GMT) Date: Thu, 15 Mar 2018 10:21:29 -0700 From: Ram Pai 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 Subject: Re: [PATCH v3] x86: treat pkey-0 special Reply-To: Ram Pai References: <1521061214-22385-1-git-send-email-linuxram@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 18031517-0040-0000-0000-000004215FEE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031517-0041-0000-0000-000026246A41 Message-Id: <20180315172129.GD1060@ram.oc3035372033.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-15_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803150189 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? RP