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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03F9B10F2867 for ; Fri, 27 Mar 2026 19:42:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4277F6B008C; Fri, 27 Mar 2026 15:42:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FEF66B0095; Fri, 27 Mar 2026 15:42:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33C106B0096; Fri, 27 Mar 2026 15:42:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 21AA06B008C for ; Fri, 27 Mar 2026 15:42:54 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C971FE1A27 for ; Fri, 27 Mar 2026 19:42:53 +0000 (UTC) X-FDA: 84592865826.27.4854FB3 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf15.hostedemail.com (Postfix) with ESMTP id 14B95A0013 for ; Fri, 27 Mar 2026 19:42:51 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=PkOvVF7w; dmarc=none; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1774640572; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XreVp1Kv2r82/Qyc1/OwNMOukhJLk7YYdp+mTT+rmN8=; b=4mN2HrArPSiXYS36JfkCRlmpD7xqONbjgqzlzsgZdCBN0J1D7TkV5IqXHyUPPEtOeLwN2w camZynpluLYNZJP39T06j+777cq/jf6PB5FgqTzeIQ+v01g9VlC6gWz45LGpX/iVPFkEK5 +kr39cUf3B7muoJYMb8fr+i29MT1mb8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1774640572; a=rsa-sha256; cv=none; b=Os+YEoPs5QIKC5c6SfZuY0PzGbJ5VsjhHHKnmTMD13ejUHEc7Kr6D0Izuxu1vmosFA2GQl tzYkQbGLKUOnb+UTPEnXfGXI9MM+4zHaPs2PTAYHbSiBQdmiV4W5dA+XldNT1M4aSmoxb8 FOKMiGBZX6r7vyVUGaGNU7oMZvxMOeU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=PkOvVF7w; dmarc=none; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 02B3B43C8F; Fri, 27 Mar 2026 19:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46674C19423; Fri, 27 Mar 2026 19:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1774640570; bh=5Cf1j8Aqd21BWFIFt8KcYU6fNdKQMFl4Tg4msm+5b/Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PkOvVF7wyyUsOQ5zORNmVnU1qLxV5bvgMiidF4v6v0Wan5C7/xVcA2MjFxe3NJwjv +PDurgOV0/+KiA9o74QEjfFlO9+AHvlRGp4N0f3CWFkJ+uqBPS9TdfSSXs+zbVzvXz QKsjEGu30vz1DQHRt9ciUC9Yoq7VYSRIfNbBCkJ8= Date: Fri, 27 Mar 2026 12:42:49 -0700 From: Andrew Morton To: Muhammad Usama Anjum Cc: David Hildenbrand , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Uladzislau Rezki , Nick Terrell , David Sterba , Vishal Moola , linux-mm@kvack.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Ryan.Roberts@arm.com, david.hildenbrand@arm.com Subject: Re: [PATCH v4 0/3] mm: Free contiguous order-0 pages efficiently Message-Id: <20260327124249.a8de2259cf3438c5f4216894@linux-foundation.org> In-Reply-To: <20260327125720.2270651-1-usama.anjum@arm.com> References: <20260327125720.2270651-1-usama.anjum@arm.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 14B95A0013 X-Stat-Signature: yyx7kwrm6i6b3j8wcam4b7abikajdb5d X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1774640571-917549 X-HE-Meta: U2FsdGVkX1+s6ED5oLrQbEsMwlP68fXDvs928GQIMTd6ksBxpvqvA5hzl5WDs5laQpqc2e0cVfZovh/gTexa2nxnx85QZWTP8VZ16Sk/bjXWzULnezHC4pLVX3UJHwrj1wCpWrCnuBzrUDw5XvP8TplloucVlXUhs48QhKsY2v6G4pZVu/s99FTgUPtd61X0gdUzAq3bHt0gxYBYjnc81lg1ewWQnqgvB6M5wJEGE+f6NGD8dT4oAZQsnDBp1A1SBIJ2BgxL5LORv8gCpaCrbL12ErP317mftyiX2Hx9hnTBJA2wuLV0bhPqKlwyMqvvBAYXvKsrqGh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aRBBlnU4I8sjFGsc7OXPj8dqBdg== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, 27 Mar 2026 12:57:12 +0000 Muhammad Usama Anjum wrote: > A recent change to vmalloc caused some performance benchmark regressions (see > [1]). I'm attempting to fix that (and at the same time significantly improve > beyond the baseline) by freeing a contiguous set of order-0 pages as a batch. > > At the same time I observed that free_contig_range() was essentially doing the > same thing as vfree() so I've fixed it there too. While at it, optimize the > __free_contig_frozen_range() as well. > > Check that the contiguous range falls in the same section. If they aren't enabled, > the if conditions get optimized out by the compiler as memdesc_section() returns 0. > See num_pages_contiguous() for more details about it. Thanks. I'm seeing impressive speedups for microbenchmarks. The speedup in [3/3] may be a bit more real-worldy. Do you have a feeling for how much difference these changes will make for any real-world workload? Also, AI review said things: https://sashiko.dev/#/patchset/20260327125720.2270651-1-usama.anjum@arm.com The can_free one (at least) seems legit. I suggest that can_free be made local to that for() loop - this would clear things up a bit.