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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 913B9C54E49 for ; Sat, 9 Mar 2024 04:54:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 056896B0071; Fri, 8 Mar 2024 23:54:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0075F6B0072; Fri, 8 Mar 2024 23:54:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E10C56B0074; Fri, 8 Mar 2024 23:54:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D112D6B0071 for ; Fri, 8 Mar 2024 23:54:49 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9F816121663 for ; Sat, 9 Mar 2024 04:54:49 +0000 (UTC) X-FDA: 81876285498.14.39532CB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf20.hostedemail.com (Postfix) with ESMTP id EA5241C0006 for ; Sat, 9 Mar 2024 04:54:47 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VJ3x71fG; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709960088; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7rWyrsf0w2AweKgC2cynq9jkTg3n3/2JTrcPx96wv4M=; b=hhfEvPtqmZ2BYZNKlmo6riIgj7w/o9RcPTAhPXSC0J3wvmn+LpkRRchxwmFp3ZSgCZKXC8 oImurMpPC4vqwbYjpw3rZSYZKgMbm0o9mBOZjV70A2CLZZyfGxhEZJZReKzZyvAXp6atle a41E1LmatOUrvR2TPn2Z6ZnTTqCbEt0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VJ3x71fG; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709960088; a=rsa-sha256; cv=none; b=cyDMNHTs3kITJlc6zc46iA18cTeDea3IjBE2NU0djYJyZ1Ln/ick+JkBvEPuwkU5huI8hK 7z66QEmM07k3UpGOuEJtvX5pV+ihSBVdaEnDFABrzcGpKNS5uvJtsXTi5qYYnLrE5IPy89 ifT+CoDj1AxIT7ycqF1Wjmpq3VnIQMM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709960087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7rWyrsf0w2AweKgC2cynq9jkTg3n3/2JTrcPx96wv4M=; b=VJ3x71fGsd3JBiVrNZErSG5b3PplTGFWrBNkQFJ13Od+29snCra/SKiDnk1b7rT4ueonFr 0ahkdS4CV+EioHE/ySoIbDclBfhXcnhEh6TXHH+lTVTugDhTsLpHkwGfBTh8kafcwqBAv+ Z/rAiHGLVuvuRIyHBrMqOoNY5OBZE/U= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-2pYKs7cqPpuiZ4Iya-GZmg-1; Fri, 08 Mar 2024 23:54:45 -0500 X-MC-Unique: 2pYKs7cqPpuiZ4Iya-GZmg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 686AD3806708; Sat, 9 Mar 2024 04:54:44 +0000 (UTC) Received: from localhost (unknown [10.72.116.15]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A89FC112131D; Sat, 9 Mar 2024 04:54:43 +0000 (UTC) Date: Sat, 9 Mar 2024 12:54:40 +0800 From: Baoquan He To: Uladzislau Rezki Cc: rulinhuang , akpm@linux-foundation.org, colin.king@intel.com, hch@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lstoakes@gmail.com, tianyou.li@intel.com, tim.c.chen@intel.com, wangyang.guo@intel.com, zhiguo.zhou@intel.com Subject: Re: [PATCH v7 1/2] mm/vmalloc: Moved macros with no functional change happened Message-ID: References: <20240301155417.1852290-1-rulin.huang@intel.com> <20240301155417.1852290-2-rulin.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: EA5241C0006 X-Stat-Signature: ogntfid79ijmoizjc5pzs3pzayi17o5w X-Rspam-User: X-HE-Tag: 1709960087-366588 X-HE-Meta: U2FsdGVkX19IfiH6R4b2KjEAzmBH+d6ic2XxrT/a25FXgP0WlvmI27ZAAx8c/pbJzUXGHRTqVlyJYco9uCjwM104Vhf5enyxufC0h18eUD2sdMHFZP9UfbmLGPPb7ldEVsU+pHh8n3lPrsw6uHaG0r8agyR78/yZDq9mHZBuAPUqBUrvtUmmqUiGJR4xM6umwNJZvdZoGCf8kxdExNM26ZOqe6LV60AE+aQLAu+mGQNhteLBoyFSI4v3LCN91hQLEdqnAUlsQJD26aW/9dUJyXQVclHhkNAgNsaLal0pHimURGv5YFLZyT4Zj/LV71cVtqqr+vFOY2+rUvrvC9sO3k3G20u6Mrcx7t1DHojzR6NCuPPjinA76bk3gSTX4ozrkmZl41YG/3lkcTtjAEq4QeHDh8lC+WtCPACXrmEAPio1chd8GBrNSUWAdadmk0dSBlLiqqqA/j9SaeV+BuO6Tu+vC72IMHb3FqmfG5z91Cg1Aa1GnEc4cmIhhv+P5LyLWuugSWPxYyMF7ut/y0H6yxJ7RBfDTZ1ZUZm2hx8Dg9sN9HW/awyKBe9ZyxR4JkytuFOBj3HSSfHu/Ps13y65endI/5yAOjkV0vmHsWFxr40Jheiptg0krjSMtLbJLuZc2Tvs6DBnMrpP5Ps+fm8vXcDFkP750CuFiE9W5izd7LL2seU6TnNEDqcMoAHrDoAmBKDkNxmngYxhmHm4sDdBvyA89fMnU3jvKLzKkiPs/m3g5R6+/PuVTvp0L1/Sajo01QY3YpvVH2NADMhEjNCljQxYTsYR4ocldEaj/jJrODBJV23/EGUIKsvWourKyC/Hk+1CTS/YHHNbJkO3xg3eqFKzvsHVtBnw5qa84F31XmdbP2gvg76jTK5rsAZT7hgcjTwCOM47Lrm8b96vOMAhGQ== 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: List-Subscribe: List-Unsubscribe: On 03/08/24 at 11:28am, Uladzislau Rezki wrote: > > > I would remove it, because it is really hard to mess it, there is only > > > one place also BUG_ON() is really a show stopper. I really appreciate > > > what rulinhuang is doing and i understand that > > > it might be not so easy. > > > > I agree, I was hesitant, now it firms up my mind. > > > > > > > > So, if we can avoid of moving the code, that looks to me that we can do, > > > if we can pass less arguments into alloc_vmap_area() since it is overloaded > > > that would be great. > > > > Agree too, less arguments is much better. While I personnally prefer the open > > coding a little bit like below. There is suspicion of excessive packaging in > > __pre/__post_setup_vmalloc_vm() wrapping. They are very simple and few > > assignments after all. > > > > --- > > mm/vmalloc.c | 20 ++++++++++++-------- > > 1 file changed, 12 insertions(+), 8 deletions(-) > > > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > index 0fd8ebaad17b..0c738423976d 100644 > > --- a/mm/vmalloc.c > > +++ b/mm/vmalloc.c > > @@ -1924,8 +1924,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, > > unsigned long align, > > unsigned long vstart, unsigned long vend, > > int node, gfp_t gfp_mask, > > - unsigned long va_flags, struct vm_struct *vm, > > - unsigned long flags, const void *caller) > > + unsigned long va_flags, struct vm_struct *vm) > > { > > struct vmap_node *vn; > > struct vmap_area *va; > > @@ -1988,8 +1987,11 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, > > va->vm = NULL; > > va->flags = (va_flags | vn_id); > > > > - if (vm) > > - setup_vmalloc_vm(vm, va, flags, caller); > > + if (vm) { > > + vm->addr = (void *)va->va_start; > > + vm->size = va->va_end - va->va_start; > > + va->vm = vm; > > + } > > > > vn = addr_to_node(va->va_start); > > > > @@ -2565,8 +2567,7 @@ static void *new_vmap_block(unsigned int order, gfp_t gfp_mask) > > va = alloc_vmap_area(VMAP_BLOCK_SIZE, VMAP_BLOCK_SIZE, > > VMALLOC_START, VMALLOC_END, > > node, gfp_mask, > > - VMAP_RAM|VMAP_BLOCK, NULL, > > - 0, NULL); > > + VMAP_RAM|VMAP_BLOCK, NULL); > > if (IS_ERR(va)) { > > kfree(vb); > > return ERR_CAST(va); > > @@ -2924,7 +2925,7 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node) > > va = alloc_vmap_area(size, PAGE_SIZE, > > VMALLOC_START, VMALLOC_END, > > node, GFP_KERNEL, VMAP_RAM, > > - NULL, 0, NULL); > > + NULL); > > if (IS_ERR(va)) > > return NULL; > > > > @@ -3063,7 +3064,10 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, > > if (!(flags & VM_NO_GUARD)) > > size += PAGE_SIZE; > > > > - va = alloc_vmap_area(size, align, start, end, node, gfp_mask, 0, area, flags, caller); > > + area->flags = flags; > > + area->caller = caller; > > + > > + va = alloc_vmap_area(size, align, start, end, node, gfp_mask, 0, area); > > if (IS_ERR(va)) { > > kfree(area); > > return NULL; > > -- > > 2.41.0 > > > Reviewed-by: Uladzislau Rezki (Sony) > > Looks even better :) It can be applied on on top of: > > [PATCH v8] mm/vmalloc: Eliminated the lock contention from twice to once > > We are a bit ahead since v8 will be taken later. Anyway please use the > reviewed-by tag once you send a complete patch. Thanks, have posted.