Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5824107imd; Wed, 31 Oct 2018 02:36:22 -0700 (PDT) X-Google-Smtp-Source: AJdET5ful9n99vFUImyMlwroxnRilSsXxApeD9BztqeomJy2jOuhi5/Kax/nmW6cM+bvAWAY8OM2 X-Received: by 2002:a17:902:f83:: with SMTP id 3-v6mr2609948plz.254.1540978582645; Wed, 31 Oct 2018 02:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540978582; cv=none; d=google.com; s=arc-20160816; b=oS9Lqyoo/zLSY+oyls9VrWlCDCJ605b/umme2IMOe00+lPhF4hoOU4UaqwuiAALinq 3gDZIidK0X5rDCsOL81eaheP1qv3br5o7yK+qOBPUIhlBN0wy1j9xw99pQreMg4ZWMo+ HoeWmz4zTqmetV4d4NJ9mfo3sXA7xmktOd52xbTvLa2gUX2U0IDLH+SoZz8ZhMthRiFV PKvsdItKZ10j4tpcY43u9j+XqgkaEwXm7/sEYBM24NaRblOshAe6AUX/6/d/cIcFbBIH FSf5e2kciGDpdKW2W7E6/i9bEzubCjiIlrnd23wY+WcdcYNtpod26swK10Bs7vaSD5oh 3wJA== 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:message-id :mime-version:references:in-reply-to:subject:cc:to:from:date; bh=h3FnUMD0Cip6ck6uid9ZheynGw1mkDnLh3Odew6YgUY=; b=zwQofuK+ATSmnOsRUDEyqjjQ3pDptTYR4mYZcHhrQp3MnfSIYyEb9rwdMcDlIjsqvY 0CrZ3vazrE72YMLmNqLY8oMJ0CFmAqzSmvJPzqLEOWssf2imJV5hdEVDCk1jaOSO9sBf 1mcowQAaWl/C2ul5Eh7d9+ETOX50iEWj9GCyXKcdsHpJkAJ4F5brw0Te9+wYWB4QZgVl FSbe9gYbk5kvAXV1N7qUMlk/VryK1DByNbfwBClTUaCDRIhLomoCXgbBFGc41HHHe9iz tGuQDnqV8omun8K0dWgKzzZX/JBtNvV5vJQZmsNj1RC7e5vl3bpSBnf+F1xAAz3WSf8Y 9iNA== 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 a10-v6si8741048pfa.227.2018.10.31.02.36.06; Wed, 31 Oct 2018 02:36:22 -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 S1727692AbeJaSdG (ORCPT + 99 others); Wed, 31 Oct 2018 14:33:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38722 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727436AbeJaSdF (ORCPT ); Wed, 31 Oct 2018 14:33:05 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9V9ZD1S067174 for ; Wed, 31 Oct 2018 05:35:44 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2nf9rhrce2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 31 Oct 2018 05:35:43 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 31 Oct 2018 09:35:42 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 31 Oct 2018 09:35:39 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9V9Zcgl63635472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 31 Oct 2018 09:35:38 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26357A4053; Wed, 31 Oct 2018 09:35:38 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D97C3A4040; Wed, 31 Oct 2018 09:35:37 +0000 (GMT) Received: from mschwideX1 (unknown [9.152.212.191]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 31 Oct 2018 09:35:37 +0000 (GMT) Date: Wed, 31 Oct 2018 10:35:36 +0100 From: Martin Schwidefsky To: "Kirill A. Shutemov" Cc: Li Wang , Guenter Roeck , Janosch Frank , "Kirill A. Shutemov" , Heiko Carstens , linux-kernel , Linux-MM Subject: Re: [PATCH 1/3] mm: introduce mm_[p4d|pud|pmd]_folded In-Reply-To: <20181031090255.bvmp3jnsdaunhzn7@kshutemo-mobl1> References: <1539621759-5967-1-git-send-email-schwidefsky@de.ibm.com> <1539621759-5967-2-git-send-email-schwidefsky@de.ibm.com> <20181031090255.bvmp3jnsdaunhzn7@kshutemo-mobl1> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18103109-0016-0000-0000-0000021CDFAE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18103109-0017-0000-0000-000032750916 Message-Id: <20181031103536.0cab673d@mschwideX1> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-31_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=980 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810310081 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 Oct 2018 12:02:55 +0300 "Kirill A. Shutemov" wrote: > On Mon, Oct 15, 2018 at 06:42:37PM +0200, Martin Schwidefsky wrote: > > Add three architecture overrideable function to test if the > > p4d, pud, or pmd layer of a page table is folded or not. > > > > Signed-off-by: Martin Schwidefsky > > --- > > include/linux/mm.h | 40 ++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 40 insertions(+) > > > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index 0416a7204be3..d1029972541c 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > Shouldn't it be somewhere in asm-generic/pgtable*? If you prefer the definitions in asm-generic that is fine with me. I'll give it a try to see if it still compiles. > > @@ -105,6 +105,46 @@ extern int mmap_rnd_compat_bits __read_mostly; > > #define mm_zero_struct_page(pp) ((void)memset((pp), 0, sizeof(struct page))) > > #endif > > > > +/* > > + * On some architectures it depends on the mm if the p4d/pud or pmd > > + * layer of the page table hierarchy is folded or not. > > + */ > > +#ifndef mm_p4d_folded > > +#define mm_p4d_folded(mm) mm_p4d_folded(mm) > > Do we need to define it in generic header? That is true, it should work without the #define in the generic header. > > +static inline bool mm_p4d_folded(struct mm_struct *mm) > > +{ > > +#ifdef __PAGETABLE_P4D_FOLDED > > + return 1; > > +#else > > + return 0; > > +#endif > > Maybe > return __is_defined(__PAGETABLE_P4D_FOLDED); > > ? I have tried that, doesn't work. The reason is that the __PAGETABLE_xxx_FOLDED defines to not have a value. #define __PAGETABLE_P4D_FOLDED #define __PAGETABLE_PMD_FOLDED #define __PAGETABLE_PUD_FOLDED While the definition of CONFIG_xxx symbols looks like this #define CONFIG_xxx 1 The __is_defined needs the value for the __take_second_arg trick. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.