From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57715C2B9F4 for ; Mon, 14 Jun 2021 13:55:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D69CF610A0 for ; Mon, 14 Jun 2021 13:55:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D69CF610A0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5958B6B006C; Mon, 14 Jun 2021 09:55:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56D4B6B006E; Mon, 14 Jun 2021 09:55:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40D136B0070; Mon, 14 Jun 2021 09:55:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 0E7B76B006C for ; Mon, 14 Jun 2021 09:55:35 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8AD4A442B for ; Mon, 14 Jun 2021 13:55:34 +0000 (UTC) X-FDA: 78252476988.40.A26E5C0 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by imf02.hostedemail.com (Postfix) with ESMTP id 849974202A0A for ; Mon, 14 Jun 2021 13:55:29 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id k40so21282603lfv.7 for ; Mon, 14 Jun 2021 06:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rfiTiAsaGwFfBsojv2IuZ/vi3R4Qmqml2BB/SXTuMxk=; b=ntDdfnb4AnV08fR6j4kCDhcqslMOtURBHNun1Y+WyDgZJhgLmTDuAqILNkJfI2+2nh Z7k7auT3eWIB4Jkjf7pwctPWx+D043MYJXHztIJf3S9+o8uSmaL9PTnrBvDgmatelZep qWPCqEpXZxWe9PDuaBdlbzbDbdCzldc+klBsh7EyxYU+LKvnba5CHJw6xcUp3A7Laf7e bHdqlOdkA4TI5X9vIjFIGHRGi+s3zdyCBrCWLVOl6+ETrOE60ssgwi3TG289hdrqtNLI tgmkmHt3z7ulRdznsybFVZu0WI2BNMot973+5C/4eO8Rcf81mys6ZrT6bWmt672FgwXh 6R2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rfiTiAsaGwFfBsojv2IuZ/vi3R4Qmqml2BB/SXTuMxk=; b=Nz0FkjunnJOVhdk+uWP2c09+vL6g/i6KwytdVNlbyuK29jpvrjYOQHjthkV85+i6nE dc4LMC0GYnOMWKQQXbtOPIM5WOV91E3z8COXzEKhl4Q8oclQBZmtYARdTXrR8aSUh+6I tcXSq4oub9OlTURnuZEK7+mmC/qTzBoBHZsfW+Aar9I6o/sXEFU/b3xpNvhKKTEYms9O V8eSjPBtumXhdJKIaozcSJHdhlsG2HS1pF0b/r22tuZAposYQzNihYRGQumLiRI73HXd yM6zihLKg0vUbqIFSn4uYPTJZ+RUyO2dpHW4xYCj+s4Eo+MCHG33WfWrRena+hUvXGXR mXIQ== X-Gm-Message-State: AOAM5315f8ezbfpFTdjbjUwPzMsUP8I3g6s+aalJ2S/soCCPeBceWMBY nzmtbU29Be61shscNnV9qpg= X-Google-Smtp-Source: ABdhPJwcoyNr5z2508ee5VPUu2JVpFWe38lsHh000t9UPgmNgU01qmagswsQ//h6nHGZIuAKUQGMUA== X-Received: by 2002:ac2:44c9:: with SMTP id d9mr12317154lfm.290.1623678932767; Mon, 14 Jun 2021 06:55:32 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id y24sm505239ljj.16.2021.06.14.06.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 06:55:32 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 14 Jun 2021 15:55:30 +0200 To: Claudio Imbrenda Cc: Claudio Imbrenda , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-s390@vger.kernel.org, frankja@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-mm@kvack.org, Uladzislau Rezki , Nicholas Piggin , Andrew Morton , Catalin Marinas , Thomas Gleixner , Ingo Molnar , David Rientjes , Christoph Hellwig Subject: Re: [PATCH v4 1/2] mm/vmalloc: add vmalloc_no_huge Message-ID: <20210614135530.GA1858@pc638.lan> References: <20210614132357.10202-1-imbrenda@linux.ibm.com> <20210614132357.10202-2-imbrenda@linux.ibm.com> <8f24292e-e8c9-9b9b-0429-2ac984a01611@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f24292e-e8c9-9b9b-0429-2ac984a01611@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=ntDdfnb4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.44 as permitted sender) smtp.mailfrom=urezki@gmail.com X-Rspamd-Server: rspam02 X-Stat-Signature: 5jsxpi8kn5s7ayxph4fzemas94bi9x4b X-Rspamd-Queue-Id: 849974202A0A X-HE-Tag: 1623678929-810923 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On 14.06.21 15:23, Claudio Imbrenda wrote: > > Commit 121e6f3258fe3 ("mm/vmalloc: hugepage vmalloc mappings") added > > support for hugepage vmalloc mappings, it also added the flag > > VM_NO_HUGE_VMAP for __vmalloc_node_range to request the allocation to > > be performed with 0-order non-huge pages. This flag is not accessible > > when calling vmalloc, the only option is to call directly > > __vmalloc_node_range, which is not exported. > > > > This means that a module can't vmalloc memory with small pages. > > > > Case in point: KVM on s390x needs to vmalloc a large area, and it needs > > to be mapped with non-huge pages, because of a hardware limitation. > > > > This patch adds the function vmalloc_no_huge, which works like vmalloc, > > but it is guaranteed to always back the mapping using small pages. This > > new function is exported, therefore it is usable by modules. > > > > Signed-off-by: Claudio Imbrenda > > Reviewed-by: Uladzislau Rezki (Sony) > > Acked-by: Nicholas Piggin > > Cc: Andrew Morton > > Cc: Nicholas Piggin > > Cc: Uladzislau Rezki (Sony) > > Cc: Catalin Marinas > > Cc: Thomas Gleixner > > Cc: Ingo Molnar > > Cc: David Rientjes > > Cc: Christoph Hellwig > > --- > > include/linux/vmalloc.h | 1 + > > mm/vmalloc.c | 16 ++++++++++++++++ > > 2 files changed, 17 insertions(+) > > > > diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h > > index 4d668abb6391..bfaaf0b6fa76 100644 > > --- a/include/linux/vmalloc.h > > +++ b/include/linux/vmalloc.h > > @@ -135,6 +135,7 @@ extern void *__vmalloc_node_range(unsigned long size, unsigned long align, > > const void *caller); > > void *__vmalloc_node(unsigned long size, unsigned long align, gfp_t gfp_mask, > > int node, const void *caller); > > +void *vmalloc_no_huge(unsigned long size); > > extern void vfree(const void *addr); > > extern void vfree_atomic(const void *addr); > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > index a13ac524f6ff..296a2fcc3fbe 100644 > > --- a/mm/vmalloc.c > > +++ b/mm/vmalloc.c > > @@ -2998,6 +2998,22 @@ void *vmalloc(unsigned long size) > > } > > EXPORT_SYMBOL(vmalloc); > > +/** > > + * vmalloc_no_huge - allocate virtually contiguous memory using small pages > > + * @size: allocation size > > + * > > + * Allocate enough non-huge pages to cover @size from the page level > > + * allocator and map them into contiguous kernel virtual space. > > + * > > + * Return: pointer to the allocated memory or %NULL on error > > + */ > > +void *vmalloc_no_huge(unsigned long size) > > +{ > > + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, GFP_KERNEL, PAGE_KERNEL, > > + VM_NO_HUGE_VMAP, NUMA_NO_NODE, __builtin_return_address(0)); > > +} > > +EXPORT_SYMBOL(vmalloc_no_huge); > > + > > /** > > * vzalloc - allocate virtually contiguous memory with zero fill > > * @size: allocation size > > > > Reviewed-by: David Hildenbrand > > Reviewed-by: Uladzislau Rezki (Sony) -- Vlad Rezki