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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15C63CD6E4A for ; Tue, 2 Jun 2026 03:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RjMhCk/o5NC1phCHo9ITOCgxpvxbQwvB79yIHI8KxIA=; b=E9diQCBywt7Dhv5Ln26e9zkMup ZBAuFcIisJcSBJNCCP9meq10OGbyxC16ZNDHZn5Lqa+NhPAaUyxLR7XS/bkqLNpcrjwRE4QKf8v4w Wayj7ZBOeTXc4yfQpBBTZXwkylc0HhW6ynsrr5QKdZUsr0LkIos+Lndytc/l/nEgD+ZSYt87+wQM6 wvEa8P+XP1JetMY4chtGQZ7S36Fie187lKvXALo48I/QpsqbBCy5NIPq7hJmXvuaUIky8fGkIXmKu FBuVySpyfiTV0l9CMIt7MWMKQnj14Pso5OPyCQkw7eXAm2QD0F4n1NLwIFgjsUNvpANoWZC6NI8/S 51MGJfuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wUG9x-0000000CFLP-1qEP; Tue, 02 Jun 2026 03:51:21 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wUG9u-0000000CFL0-3Q6t for linux-arm-kernel@lists.infradead.org; Tue, 02 Jun 2026 03:51:20 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 429FD437F8; Tue, 2 Jun 2026 03:51:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F1C31F00893; Tue, 2 Jun 2026 03:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780372277; bh=RjMhCk/o5NC1phCHo9ITOCgxpvxbQwvB79yIHI8KxIA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=YxSsoNn5YJCuKxeKl6PAX++Bg1aMM2RevmuoB3R+3Asp5hkDYkYRJMv/TpeoLf9B7 Ro5GqUKqVtSJmc5PF+GpOiLc0azL+gPTApbXdxRHccH8Hr+f9xJ7//k0XcZqLOHvSi kGrbwecefO6SaCt1vbjnccI71sOts8z+Y7MsYvqGsWup39aDDNQTED3u4+lj/rv/8F syhtFXtiRdqG9CWJa2E8dieXcFf76SrQLQvLUGV2C2xznjLRecAhHWsKvgkLiwkJ25 xTybY/DuKaU+pdIyACHJmrYf48SqhRY4KcLhkA2h2XeK7eAcBCWailPapF06VTCHY9 SOQC8eSGQAvkQ== Date: Tue, 2 Jun 2026 05:51:03 +0200 From: "Oscar Salvador (SUSE)" To: Usama Arif Cc: Andrew Morton , david@kernel.org, willy@infradead.org, ryan.roberts@arm.com, linux-mm@kvack.org, pfalcato@suse.de, r@hev.cc, jack@suse.cz, Andrew Donnellan , apopple@nvidia.com, baohua@kernel.org, baolin.wang@linux.alibaba.com, brauner@kernel.org, catalin.marinas@arm.com, dev.jain@arm.com, kees@kernel.org, kevin.brodsky@arm.com, lance.yang@linux.dev, "Liam R. Howlett" , linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, ljs@kernel.org, mhocko@suse.com, npache@redhat.com, pasha.tatashin@soleen.com, rmclure@linux.ibm.com, rppt@kernel.org, surenb@google.com, vbabka@kernel.org, Al Viro , ziy@nvidia.com, hannes@cmpxchg.org, kas@kernel.org, shakeel.butt@linux.dev, kernel-team@meta.com Subject: Re: [PATCH v7 1/2] mm: bypass mmap_miss heuristic for VM_EXEC readahead Message-ID: References: <20260601102205.3985788-1-usama.arif@linux.dev> <20260601102205.3985788-2-usama.arif@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260601102205.3985788-2-usama.arif@linux.dev> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260601_205118_887905_00E27DB5 X-CRM114-Status: GOOD ( 14.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 01, 2026 at 03:21:17AM -0700, Usama Arif wrote: > The mmap_miss heuristic is intended to stop speculative mmap readahead > when a file looks like a random-access workload. That does not fit the > VM_EXEC path very well. > > VM_EXEC readahead is already constrained differently from ordinary mmap > read-around: it is bounded by the VMA, uses exec_folio_order() to choose > an order useful for executable mappings, and sets async_size to 0 so it > does not create follow-on readahead. When VM_HUGEPAGE is also present, > the larger readahead is an explicit userspace opt-in. > > The mmap_miss counter is decremented from cache-hit paths in > do_async_mmap_readahead() and filemap_map_pages(). Those paths are not > always enough to balance the synchronous miss increments for executable > mappings. In particular, when fault-around is effectively disabled, such > as configurations where fault_around_pages is 1, filemap_map_pages() is > not reached from the fault path. The counter can then become a stale > throttle for VM_EXEC mappings and suppress the readahead behavior that > the executable-specific path is trying to provide. > > Skip both mmap_miss increments and decrements for VM_EXEC mappings, > matching the existing VM_SEQ_READ treatment and keeping the counter > accounting symmetric. > > Signed-off-by: Usama Arif > Reviewed-by: Jan Kara > Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: Oscar Salvador (SUSE) -- Oscar Salvador SUSE Labs