Message ID | 20230714141218.947137012@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2537036vqm; Fri, 14 Jul 2023 07:19:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlFGy82r1XlfwdOYDSONCFxId46RKSCw7AYptVzCt4F+WiOBU9sGtr95+9PlDbPuZBRUqt8y X-Received: by 2002:aa7:8894:0:b0:682:4edf:b9c7 with SMTP id z20-20020aa78894000000b006824edfb9c7mr6577141pfe.2.1689344364950; Fri, 14 Jul 2023 07:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689344364; cv=none; d=google.com; s=arc-20160816; b=C06QxtG9mjuiZbo60X/xQ6rOi2UkzzEBtS4SadltinfDl+ImGUK8H8mGQGF9ToDB38 iEYWU/cg5gLu7nydXfv+F61ENCDrJwYEfNODAWrBGVamz1oysy0ZdJTk/9U52fAo8rzM zHbncDl0btGmZIz4WU+38nG5fDKv3YsZSOo0oegz+Qf5fJrOu9ZmnPgtPl0IssOgJP5i 92U6eRSQstKhUbuXJIHruJNSWNRtJej5U2kry+dTunBcOh0EetgQIzEdWzEGZy5wYCvR MXKYNDELxLRf8pN/Tj5kCMAC/HIThhQWt6R66MdvVb35dZwoH8AN9xBBb36gtKQoNq5Z 4tlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=vd7IZ5Q9sG2aEX5C+B5mpNsAgNCXrsR4bE5i4Du1qnc=; fh=EjmxZ37PYlcfWlhzAqi5wmPe8R8k7/dCt/LKb5qak3s=; b=D+DmeQhJcuJ0zVFYAQGnTeDJqkgC2JybaPBBtVCDs5/6dt82d9NS5f6iSCP8iccIHk L78GjTm+NYIXznmJH9jNa/evNUrpgPwAqBZ8xVl+FUicz3STUyEgeYY3rLAcI1tjV9lI JU6zjg5YuZon0WJsDgWogD94EgyyYL+vKzL0DRjT2Ca5Ms9lpg9jan+8kX0IvaFeAsH5 vle+Tz9yyepokGngHF6P9J55II0gJxed2zn8FYPM9/AheqIyD9OVWMB//OKz13waLjvh HZpwRNZU9BrqTQ4qkgeyYvXkFDKfdH4+K7hEHkI4/kJVdXehFjOp/vWfYcp7hR1qf8an 1KEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=X9gijMCm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020a056a001d1000b0067b51fca490si7039736pfx.248.2023.07.14.07.19.05; Fri, 14 Jul 2023 07:19:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=X9gijMCm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235463AbjGNORA (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Fri, 14 Jul 2023 10:17:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235719AbjGNOQn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 14 Jul 2023 10:16:43 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BAF71989; Fri, 14 Jul 2023 07:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=vd7IZ5Q9sG2aEX5C+B5mpNsAgNCXrsR4bE5i4Du1qnc=; b=X9gijMCmfaPrSsayyWL0NuHiOe pGOhwRRTPBsZ40IXNFRORyzItcRWv4X+M3D/uQhswBiY0asbLlff6VJbJ0JHPEZfFMXjzmVs0I3h2 zIKqL8xHXO1+pjyWMBoxtpmq/8rxGe7cTHGeZ59jD2gdh/RhQ1gSNvuGbpNqbMkv4kEbOqjxxt/Bk BXDNnfyaPMAZRHuxBHH6Wfgfjrb5LqQ6zKpgZIsXsl9TYZBQrbC9LXYFJBv8YGZQfOAumvP+LAfQH DKKaLDkbVrzm/PSaPiAwV1U7mLa+G0455XJv/+IXRtYsqpaPxRb6KOlKfb+F71dSxkGZZpqg+7ydQ MafKW0bA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qKJah-006Iiz-2D; Fri, 14 Jul 2023 14:16:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B2786300C88; Fri, 14 Jul 2023 16:16:14 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 72FA0213728B8; Fri, 14 Jul 2023 16:16:13 +0200 (CEST) Message-ID: <20230714141218.947137012@infradead.org> User-Agent: quilt/0.66 Date: Fri, 14 Jul 2023 15:39:04 +0200 From: Peter Zijlstra <peterz@infradead.org> To: tglx@linutronix.de, axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, dvhart@infradead.org, dave@stgolabs.net, andrealmeid@igalia.com, Andrew Morton <akpm@linux-foundation.org>, urezki@gmail.com, hch@infradead.org, lstoakes@gmail.com, Arnd Bergmann <arnd@arndb.de>, linux-api@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, malteskarupke@web.de Subject: [RFC][PATCH 05/10] mm: Add vmalloc_huge_node() References: <20230714133859.305719029@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771405956884784894 X-GMAIL-MSGID: 1771405956884784894 |
Series |
futex: More Futex2 bits
|
|
Commit Message
Peter Zijlstra
July 14, 2023, 1:39 p.m. UTC
To enable node specific hash-tables.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/vmalloc.h | 1 +
mm/vmalloc.c | 11 ++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
Comments
On Fri, Jul 14, 2023 at 03:39:04PM +0200, Peter Zijlstra wrote: > +void *vmalloc_huge_node(unsigned long size, gfp_t gfp_mask, int node) > +{ > + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, > + gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP, > + node, __builtin_return_address(0)); > +} > + > /** > * vmalloc_huge - allocate virtually contiguous memory, allow huge pages > * @size: allocation size > @@ -3430,9 +3437,7 @@ EXPORT_SYMBOL(vmalloc); > */ > void *vmalloc_huge(unsigned long size, gfp_t gfp_mask) > { > - return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, > - gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP, > - NUMA_NO_NODE, __builtin_return_address(0)); > + return vmalloc_huge_node(size, gfp_mask, NUMA_NO_NODE); > } Isn't this going to result in the "caller" being always recorded as vmalloc_huge() instead of the caller of vmalloc_huge()?
On Fri, Jul 14, 2023 at 03:37:38PM +0100, Matthew Wilcox wrote: > On Fri, Jul 14, 2023 at 03:39:04PM +0200, Peter Zijlstra wrote: > > +void *vmalloc_huge_node(unsigned long size, gfp_t gfp_mask, int node) > > +{ > > + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, > > + gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP, > > + node, __builtin_return_address(0)); > > +} > > + > > /** > > * vmalloc_huge - allocate virtually contiguous memory, allow huge pages > > * @size: allocation size > > @@ -3430,9 +3437,7 @@ EXPORT_SYMBOL(vmalloc); > > */ > > void *vmalloc_huge(unsigned long size, gfp_t gfp_mask) > > { > > - return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, > > - gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP, > > - NUMA_NO_NODE, __builtin_return_address(0)); > > + return vmalloc_huge_node(size, gfp_mask, NUMA_NO_NODE); > > } > > Isn't this going to result in the "caller" being always recorded as > vmalloc_huge() instead of the caller of vmalloc_huge()? Durr, I missed that, but it depends, not if the compiler inlines it. I'll make a common __always_inline helper to cure this.
On Fri, Jul 14, 2023 at 05:09:48PM +0200, Peter Zijlstra wrote: > On Fri, Jul 14, 2023 at 03:37:38PM +0100, Matthew Wilcox wrote: > > On Fri, Jul 14, 2023 at 03:39:04PM +0200, Peter Zijlstra wrote: > > > +void *vmalloc_huge_node(unsigned long size, gfp_t gfp_mask, int node) > > > +{ > > > + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, > > > + gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP, > > > + node, __builtin_return_address(0)); > > > +} > > > + > > > /** > > > * vmalloc_huge - allocate virtually contiguous memory, allow huge pages > > > * @size: allocation size > > > @@ -3430,9 +3437,7 @@ EXPORT_SYMBOL(vmalloc); > > > */ > > > void *vmalloc_huge(unsigned long size, gfp_t gfp_mask) > > > { > > > - return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, > > > - gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP, > > > - NUMA_NO_NODE, __builtin_return_address(0)); > > > + return vmalloc_huge_node(size, gfp_mask, NUMA_NO_NODE); > > > } > > > > Isn't this going to result in the "caller" being always recorded as > > vmalloc_huge() instead of the caller of vmalloc_huge()? > > Durr, I missed that, but it depends, not if the compiler inlines it. > > I'll make a common __always_inline helper to cure this. ... or just don't change vmalloc_huge()? Or make the common helper take the __builtin_return_address as a parameter?
On Fri, Jul 14, 2023 at 04:11:39PM +0100, Matthew Wilcox wrote:
> ... or just don't change vmalloc_huge()?
Yeah, that, everything else just adds more lines without read benefit. I
eneded up with the below.
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -152,6 +152,7 @@ extern void *__vmalloc_node_range(unsign
void *__vmalloc_node(unsigned long size, unsigned long align, gfp_t gfp_mask,
int node, const void *caller) __alloc_size(1);
void *vmalloc_huge(unsigned long size, gfp_t gfp_mask) __alloc_size(1);
+void *vmalloc_huge_node(unsigned long size, gfp_t gfp_mask, int node) __alloc_size(1);
extern void *__vmalloc_array(size_t n, size_t size, gfp_t flags) __alloc_size(1, 2);
extern void *vmalloc_array(size_t n, size_t size) __alloc_size(1, 2);
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -3416,6 +3416,13 @@ void *vmalloc(unsigned long size)
}
EXPORT_SYMBOL(vmalloc);
+void *vmalloc_huge_node(unsigned long size, gfp_t gfp_mask, int node)
+{
+ return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
+ gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP,
+ node, __builtin_return_address(0));
+}
+
/**
* vmalloc_huge - allocate virtually contiguous memory, allow huge pages
* @size: allocation size
--- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -152,6 +152,7 @@ extern void *__vmalloc_node_range(unsign void *__vmalloc_node(unsigned long size, unsigned long align, gfp_t gfp_mask, int node, const void *caller) __alloc_size(1); void *vmalloc_huge(unsigned long size, gfp_t gfp_mask) __alloc_size(1); +void *vmalloc_huge_node(unsigned long size, gfp_t gfp_mask, int node) __alloc_size(1); extern void *__vmalloc_array(size_t n, size_t size, gfp_t flags) __alloc_size(1, 2); extern void *vmalloc_array(size_t n, size_t size) __alloc_size(1, 2); --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3416,6 +3416,13 @@ void *vmalloc(unsigned long size) } EXPORT_SYMBOL(vmalloc); +void *vmalloc_huge_node(unsigned long size, gfp_t gfp_mask, int node) +{ + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, + gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP, + node, __builtin_return_address(0)); +} + /** * vmalloc_huge - allocate virtually contiguous memory, allow huge pages * @size: allocation size @@ -3430,9 +3437,7 @@ EXPORT_SYMBOL(vmalloc); */ void *vmalloc_huge(unsigned long size, gfp_t gfp_mask) { - return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, - gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP, - NUMA_NO_NODE, __builtin_return_address(0)); + return vmalloc_huge_node(size, gfp_mask, NUMA_NO_NODE); } EXPORT_SYMBOL_GPL(vmalloc_huge);