Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1292403imm; Wed, 20 Jun 2018 15:18:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKHR5yslwAwTM1wD0QtckLQ2w3VeX5SXLWHoGKm8vAID32sKCxDnGi8c36h5YMZd6q+x04E X-Received: by 2002:a63:8f19:: with SMTP id n25-v6mr20653473pgd.344.1529533099519; Wed, 20 Jun 2018 15:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529533099; cv=none; d=google.com; s=arc-20160816; b=zXHIUZQMUUUHunTxanmYde4vCI9GePHySZAZ4VL6PxCrszCIr2a6I8OiTLYQuasJCm 8KOetHB4CWz28fW3w0D2FmuiN6KVywLty8jjWV/F1ZQXM0OX/vorLhhT7ngfmzcjHcDq 8BwDAT4p3+EEu1v+g53Bpc7pdSuHBkn6w4S3mvoduiuGna9biA8CS7/eJRSPaiziXwf0 FEOpOHGyauwzOGyKcRN2HMgR4S1j6Civ0Pip4tSDGUNoDzzGLyg1GbXOTCy0v51CBYOQ NgnafE3OIV0Pq+gebjwk6yUXU68weLOoNCUu6Zpk5lug7v080TE4hvyoYKA+Pu8t8LEO uOTw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=ZTh5juJ0Ylj+WUkpLsSn4PNTtkx8QCqCceOp2aTjH9Y=; b=SHwFL1PzLQU1/HPD43rHXMJRD9wPSNQW22M0nh/+sLo5Q07ms9Oo9ypTPGCc1u1oxA K/SXhyrQkZZRtiQvedbD2VrHDSMl6/mikzvBLN2XhdNmwoNLPdm84HcuYEWcj59i3Jsb eY+tMgr0w3wxfy3zj5I8WxZvWZcH+B1qVSBxsfXP521xh1WydsBKa/N6LWumdc7nc9dm eTG8AuFpAF4IUck5klvc3BWEq+39KSlcLYXCqBJjEVJOUCrA3crAw6SOAsnPGyFBK942 g4ZrGNQV3LrRKxbLHA4G2DojIsqXP1iUi53Ko/8RCMNq8U64ZjLSW8VN88ket6ZwWaFf ODiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=rCkjLU+G; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9-v6si2650376pgv.501.2018.06.20.15.18.05; Wed, 20 Jun 2018 15:18:19 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=rCkjLU+G; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933627AbeFTWRI (ORCPT + 99 others); Wed, 20 Jun 2018 18:17:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45624 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933460AbeFTWRH (ORCPT ); Wed, 20 Jun 2018 18:17:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZTh5juJ0Ylj+WUkpLsSn4PNTtkx8QCqCceOp2aTjH9Y=; b=rCkjLU+GTi/4Z+bLFPGVELIcL 7328zKRE2Upv1Pn0yDLf5J2JHDg8u3IT4wp5l/aPpxXRFFS8MI4LSeC+1/YDLV+sSGgGFmgr0Fja9 tAEEoOgAx1Y+INRONfE7H7l/B0LwZHcn0TkESQaNSpE0UngUV7uFmOd7EenTAFwe01ustE66h6lFJ yqc5AIlixtp+uU2pCx65pI9/oTmkJwSvL0rcxVoPPy1EWjj8zw7bV/7kzNLoF1U7JnOCuY7vmJgP1 0U4QfmaF6O6pYxvx/Ubclo/OhMkqri2B0+GPynKsy1XRvldiNE+V/2birUYcm+E3aVi2t+BpPIXvY dMk/eWtqA==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVlPI-0006FU-8V; Wed, 20 Jun 2018 22:16:52 +0000 Subject: Re: [PATCH 1/3] vmalloc: Add __vmalloc_node_try_addr function To: Rick Edgecombe , tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com Cc: kristen.c.accardi@intel.com, dave.hansen@intel.com, arjan.van.de.ven@intel.com References: <1529532570-21765-1-git-send-email-rick.p.edgecombe@intel.com> <1529532570-21765-2-git-send-email-rick.p.edgecombe@intel.com> From: Randy Dunlap Message-ID: <12014310-19f7-dc31-d983-9c7e00c8b446@infradead.org> Date: Wed, 20 Jun 2018 15:16:50 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1529532570-21765-2-git-send-email-rick.p.edgecombe@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/20/2018 03:09 PM, Rick Edgecombe wrote: > Create __vmalloc_node_try_addr function that tries to allocate at a specific > address. The implementation relies on __vmalloc_node_range for the bulk of the > work. To keep this function from spamming the logs when an allocation failure > is fails, __vmalloc_node_range is changed to only warn when __GFP_NOWARN is not > set. This behavior is consistent with this flags interpretation in > alloc_vmap_area. > > Signed-off-by: Rick Edgecombe > --- > include/linux/vmalloc.h | 3 +++ > mm/vmalloc.c | 41 +++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 42 insertions(+), 2 deletions(-) > > diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h > index 398e9c9..6eaa896 100644 > --- a/include/linux/vmalloc.h > +++ b/include/linux/vmalloc.h > @@ -82,6 +82,9 @@ extern void *__vmalloc_node_range(unsigned long size, unsigned long align, > unsigned long start, unsigned long end, gfp_t gfp_mask, > pgprot_t prot, unsigned long vm_flags, int node, > const void *caller); > +extern void *__vmalloc_node_try_addr(unsigned long addr, unsigned long size, > + gfp_t gfp_mask, pgprot_t prot, unsigned long vm_flags, > + int node, const void *caller); > #ifndef CONFIG_MMU > extern void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags); > static inline void *__vmalloc_node_flags_caller(unsigned long size, int node, > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index cfea25b..9e0820c9 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -1710,6 +1710,42 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, > } > > /** > + * __vmalloc_try_addr - try to alloc at a specific address * __vmalloc_node_try_addr - try to allocate at a specific address > + * @addr: address to try > + * @size: size to try > + * @gfp_mask: flags for the page level allocator > + * @prot: protection mask for the allocated pages > + * @vm_flags: additional vm area flags (e.g. %VM_NO_GUARD) > + * @node: node to use for allocation or NUMA_NO_NODE > + * @caller: caller's return address > + * > + * Try to allocate at the specific address. If it succeeds the address is > + * returned. If it fails NULL is returned. It may trigger TLB flushes. > + */ > +void *__vmalloc_node_try_addr(unsigned long addr, unsigned long size, > + gfp_t gfp_mask, pgprot_t prot, unsigned long vm_flags, > + int node, const void *caller) > +{ so this isn't optional, eh? You are going to force it on people because? thanks, -- ~Randy