From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCE03182D0 for ; Wed, 17 Dec 2025 03:54:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765943681; cv=none; b=sXFVl2hz1CONoMtm2KnL7QaCs4Mxl6izfQ7ykZUQ8IxZTSIZKwZyTs6XGAbpHyMYHgDOpUBWMzxPf/COUQ1rF8+n+qWs0J61Y0aNrDGSHa/nEl2OalqApCfDizy1NW966j6XjSMp2J0gQIERawWmNz0zD6efS1j2DNxSKfHmnck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765943681; c=relaxed/simple; bh=K7CNhdUkGRopcvD9B2HHDp/zvkyyajCnHqxCu1kBXIM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jAsqkF/uAb/CGMoE8h3zJ4ljlfF9c9WOzsi00A5PpIxQJxa5I+0ET9K9yIsYSKW8uD/TPCGnW6/EkU1aGsk1yw2oZacXnICopIYMx2lA3Uj/KQ5Nxr7kKjsDJCmoC3Y5kYLBmatE0o/6UKAQWt35C4tajCumsQ5Y0n+SkU+Mmk4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VQr/6Te7; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VQr/6Te7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765943678; 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=Iu41GupITfJHs+uamnM8CoHi7wHfnhmUZdXDqfpIqYY=; b=VQr/6Te7EtlJCBxf7CAdkTQ0NwzHBvw/4+92j5gKACyeExQdMwTh1WZ9ACE8dhiwLjzOjo GPKH+uMKb1wU7LPYEIt5BXEHwuTa47wOWOJsLK9l/hwmVLezIZZRdk/Mn7BIJSM4mjGkBS Xz2wyE5LO+tbdQB2LhV2hoW4Ob1zX4w= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-tFxPahEsOROXhHm-9IDUJw-1; Tue, 16 Dec 2025 22:54:35 -0500 X-MC-Unique: tFxPahEsOROXhHm-9IDUJw-1 X-Mimecast-MFC-AGG-ID: tFxPahEsOROXhHm-9IDUJw_1765943674 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8C0E41800620; Wed, 17 Dec 2025 03:54:33 +0000 (UTC) Received: from localhost (unknown [10.72.112.95]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 27179180044F; Wed, 17 Dec 2025 03:54:31 +0000 (UTC) Date: Wed, 17 Dec 2025 11:54:26 +0800 From: Baoquan He To: "Uladzislau Rezki (Sony)" Cc: linux-mm@kvack.org, Andrew Morton , Vishal Moola , Ryan Roberts , Dev Jain , LKML Subject: Re: [PATCH 2/2] mm/vmalloc: Add attempt_larger_order_alloc parameter Message-ID: References: <20251216211921.1401147-1-urezki@gmail.com> <20251216211921.1401147-2-urezki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251216211921.1401147-2-urezki@gmail.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Hi Uladzislau, On 12/16/25 at 10:19pm, Uladzislau Rezki (Sony) wrote: > Introduce a module parameter to enable or disable the large-order > allocation path in vmalloc. High-order allocations are disabled by > default so far, but users may explicitly enable them at runtime if > desired. > > High-order pages allocated for vmalloc are immediately split into > order-0 pages and later freed as order-0, which means they do not > feed the per-CPU page caches. As a result, high-order attempts tend I don't get why order-0 do not feed the PCP caches. > to bypass the PCP fastpath and fall back to the buddy allocator that > can affect performance. > > However, when the PCP caches are empty, high-order allocations may > show better performance characteristics especially for larger > allocation requests. And when PCP is empty, high-order alloc show better performance. Could you please help elaborate a little more about them? Thanks. Thanks Baoquan > > Since the best strategy is workload-dependent, this patch adds a > parameter letting users to choose whether vmalloc should try > high-order allocations or stay strictly on the order-0 fastpath. > > Signed-off-by: Uladzislau Rezki (Sony) > --- > mm/vmalloc.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index d3a4725e15ca..f66543896b16 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -43,6 +43,7 @@ > #include > #include > #include > +#include > > #define CREATE_TRACE_POINTS > #include > @@ -3671,6 +3672,9 @@ vm_area_alloc_pages_large_order(gfp_t gfp, int nid, unsigned int order, > return nr_allocated; > } > > +static int attempt_larger_order_alloc; > +module_param(attempt_larger_order_alloc, int, 0644); > + > static inline unsigned int > vm_area_alloc_pages(gfp_t gfp, int nid, > unsigned int order, unsigned int nr_pages, struct page **pages) > @@ -3679,8 +3683,9 @@ vm_area_alloc_pages(gfp_t gfp, int nid, > struct page *page; > int i; > > - nr_allocated = vm_area_alloc_pages_large_order(gfp, nid, > - order, nr_pages, pages); > + if (attempt_larger_order_alloc) > + nr_allocated = vm_area_alloc_pages_large_order(gfp, nid, > + order, nr_pages, pages); > > /* > * For order-0 pages we make use of bulk allocator, if > -- > 2.47.3 >