From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4CBFD156F20 for ; Mon, 26 Jan 2026 19:05:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769454352; cv=none; b=mNBPh2eOYlR69+keqw+P2WF0NX2QlxCorrBnhZ70jW8750kI4SlUJOKQ/mD+MOqnu5EGEE7RMIEoyrkpjVwj6yLzwU4ApHhEa1KVfQE0wXMKwXgeLjX3quGpA6usuQfF2sEMBgsSHFSvpnWeiml6vwoOXnUdAPKAHopvuRF2zW4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769454352; c=relaxed/simple; bh=Qh0o6frWdN7mJ02mqItx1PK4gLJtn94sv0Eb3M1IpVg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=MAYunzw9MJSgAaZOLexp4Bx9rK/7SUJqWdZLcwiA47qjkmAxw9848oYum0aMU9zHraL5Gprfu2+NBQs3bJTTzEp3Dz4YM3EhbwTyDputuTvktZ382FQ+KoTbufmHzthRQ0SDUvVynLdKHapq3zmvNC6CtcXRG9QU43kMGcQPWIM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=DnHvLCpS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="DnHvLCpS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D80EC116C6; Mon, 26 Jan 2026 19:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1769454351; bh=Qh0o6frWdN7mJ02mqItx1PK4gLJtn94sv0Eb3M1IpVg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DnHvLCpSUmJ1NeZ/lqAsck/JGOrOhc99RsJ8vee97FxOXDShBzBieIEHn9D/AHByJ O5Pn7WgIrD4GVrsvG2b01PUBk7TQIeCksLVBVe9p+nAnyY7JyWLxPYAb3yPtOC6RD6 8R18iPoBEbQ9d0sQgTstl8BkrooE8OeWeQlyV2Vk= Date: Mon, 26 Jan 2026 11:05:50 -0800 From: Andrew Morton To: Ankur Arora Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, david@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mingo@redhat.com, mjguzik@gmail.com, luto@kernel.org, peterz@infradead.org, tglx@linutronix.de, willy@infradead.org, raghavendra.kt@amd.com, chleroy@kernel.org, ioworker0@gmail.com, lizhe.67@bytedance.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, kernel test robot Subject: Re: [PATCH] mm: folio_zero_user: open code range computation in folio_zero_user() Message-Id: <20260126110550.0df8f68ea232a745c187b2a6@linux-foundation.org> In-Reply-To: <20260126183212.2366596-1-ankur.a.arora@oracle.com> References: <20260107072009.1615991-9-ankur.a.arora@oracle.com> <20260126183212.2366596-1-ankur.a.arora@oracle.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Mon, 26 Jan 2026 10:32:12 -0800 Ankur Arora wrote: > riscv64-gcc-linux-gnu (v8.5) reports a compile time assert in: > > r[2] = DEFINE_RANGE(clamp_t(s64, fault_idx - radius, pg.start, pg.end), > clamp_t(s64, fault_idx + radius, pg.start, pg.end)); > > where it decides that pg.start > pg.end in: > clamp_t(s64, fault_idx + radius, pg.start, pg.end)); > > where pg comes from: > const struct range pg = DEFINE_RANGE(0, folio_nr_pages(folio) - 1); > > That does not seem like it could be true. Even for pg.start == pg.end, > we would need folio_test_large() to evaluate to false at compile time: > > static inline unsigned long folio_nr_pages(const struct folio *folio) > { > if (!folio_test_large(folio)) > return 1; > return folio_large_nr_pages(folio); > } > > Workaround by open coding the range computation. Also, simplify the type > declarations for the relevant variables. Thanks. It's a shame. gcc-8.50 is five years old. Documentation/Changes says we support 8.1. > I'm not certain about linux-next rebasing protocol, but I'm guessing > this patch will be squashed in patch-8 ("mm: folio_zero_user: cache > neighbouring pages"). If the base patch was in mm-unstable then I'd squash. But it is now in the allegedly non-rebasing mm-stable so I'll queue this into mm-unstable->mm-stable as a separate thing, with Fixes: 93552c9a3350 ("mm: folio_zero_user: cache neighbouring pages") So there will be a bisection hole for riscv people who use an ancient compiler, shrug. > mm/memory.c | 23 +++++++++++------------ > 1 file changed, 11 insertions(+), 12 deletions(-) We could of course revert this when we're able to confirm that the currently-supported gcc versions all handle it OK.