From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE9C9399356 for ; Thu, 4 Jun 2026 19:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780601616; cv=none; b=ejsTm6h8rF8jtarSWWfZcymjfxIRYBG7BPvYbpPzi4r891KTphUfRK2ZnmrTCRO4H8HLSjgt36CLci10q4wT81n81FtlFRY7FCZA3ytuSliy00aaLsYQ2a29aNajcWebHwYL/5XSTCryCh9WivZgxD/aLe3cfGZA7C5DpxYtTe4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780601616; c=relaxed/simple; bh=1S4+fX6xWHQsqyDmxIWpC9Dg22EPzfPvMVi2gkLl0jI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G0gAUKp8bzKQoobbKVB7v/a3TiQHk26SZtP2KIhFBUxQ06/dt+PcbxweVK/4V8ES2liMeKSw+bLzDm+OBNijgb8xAcGVnruaHSO8k8UnQNqduqcqDQXSXjkGwbL1SYMhC+zR3v3+xv2zQu+jy+EzFVilr6+sS90DDuxTwDKvrBk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=WIZh2DVy; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=qbCYaYtt; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=WIZh2DVy; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=qbCYaYtt; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="WIZh2DVy"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="qbCYaYtt"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="WIZh2DVy"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="qbCYaYtt" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 121786B070; Thu, 4 Jun 2026 19:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1780601613; h=from:from:reply-to: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=17A0fGLj3810t+Y/YXXQUqyaPr5NJ91ZX0M+6IS2/zE=; b=WIZh2DVyNF+J88p0RUcOfFrQZtq1yBCwnN3RA6FJxULVMT6skJVz+LwPJjurOLVHJMDP/r Mga0TWzFCLlmQhvU2G6x6zAk7kpocfztQRzWKvVwrafWSvgUbUyL6yxtjLMaBZp1KhYnd4 dNaZQkQ+SxY2xtISp2dgVttb2GqYPIs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1780601613; h=from:from:reply-to: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=17A0fGLj3810t+Y/YXXQUqyaPr5NJ91ZX0M+6IS2/zE=; b=qbCYaYttIPyQ8PjOpFOnhqBob8yWUW3rtX5CfN6zNOJm7Cn8y46bqT9urzlCUp+NvpZ3TF r/rERYsIDHeu9RBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1780601613; h=from:from:reply-to: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=17A0fGLj3810t+Y/YXXQUqyaPr5NJ91ZX0M+6IS2/zE=; b=WIZh2DVyNF+J88p0RUcOfFrQZtq1yBCwnN3RA6FJxULVMT6skJVz+LwPJjurOLVHJMDP/r Mga0TWzFCLlmQhvU2G6x6zAk7kpocfztQRzWKvVwrafWSvgUbUyL6yxtjLMaBZp1KhYnd4 dNaZQkQ+SxY2xtISp2dgVttb2GqYPIs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1780601613; h=from:from:reply-to: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=17A0fGLj3810t+Y/YXXQUqyaPr5NJ91ZX0M+6IS2/zE=; b=qbCYaYttIPyQ8PjOpFOnhqBob8yWUW3rtX5CfN6zNOJm7Cn8y46bqT9urzlCUp+NvpZ3TF r/rERYsIDHeu9RBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 08564779A8; Thu, 4 Jun 2026 19:33:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 10u7OAnTIWo3EwAAD6G6ig (envelope-from ); Thu, 04 Jun 2026 19:33:29 +0000 Date: Thu, 4 Jun 2026 20:33:23 +0100 From: Pedro Falcato To: Usama Arif Cc: Andrew Morton , david@kernel.org, willy@infradead.org, ryan.roberts@arm.com, linux-mm@kvack.org, 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 2/2] mm: use mapping_max_folio_order() for force_thp_readahead order Message-ID: References: <20260601102205.3985788-1-usama.arif@linux.dev> <20260601102205.3985788-3-usama.arif@linux.dev> Precedence: bulk X-Mailing-List: linux-fsdevel@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: <20260601102205.3985788-3-usama.arif@linux.dev> X-Spam-Flag: NO X-Spam-Score: -2.30 X-Spamd-Result: default: False [-2.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[36]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLxu57a9hfgn7tttf5jiwuqe5o)]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; TAGGED_RCPT(0.00)[kernel]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,linux.dev:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Level: On Mon, Jun 01, 2026 at 03:21:18AM -0700, Usama Arif wrote: > The force_thp_readahead path in do_sync_mmap_readahead() is gated on > HPAGE_PMD_ORDER <= MAX_PAGECACHE_ORDER and always requests > HPAGE_PMD_ORDER / HPAGE_PMD_NR. On configurations where HPAGE_PMD_ORDER > exceeds MAX_PAGECACHE_ORDER, notably arm64 with a 64K base page size, > VM_HUGEPAGE mappings cannot use this path and fall back to the non-forced > mmap readahead path even when the mapping supports useful large folios. > > Enable forced readahead for mappings that support large folios and request > the max folio order supported by the mapping, capped at 2M. > 2MB is chosen as the cap because it matches the PMD size on x86_64 > and on arm64 with 4K base pages, so the size/memory-pressure tradeoff > for folios of that size is already well understood. On arm64 with 16K > and 64K base page sizes, 2MB is also the contiguous-PTE (contpte) > block size, so the resulting folios coalesce into a single TLB entry > and reduce TLB pressure on the readahead path. This will result > in 32M folios not being faulted in with 16K base page size for arm64, > but with contpte, the performance difference should be negligible. > > The final allocation order may still be clamped by page_cache_ra_order() > to the mapping and request geometry, but this gives VM_HUGEPAGE mappings > on such configurations a large-folio readahead request instead of > dropping back to base-page readahead. > > Signed-off-by: Usama Arif Reviewed-by: Pedro Falcato Overall LGTM. Lets see if performance doesn't degrade. /me hides in cover -- Pedro