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]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7BCCC28B28 for ; Sat, 8 Mar 2025 21:34:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46C766B0082; Sat, 8 Mar 2025 16:34:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 41C9B6B0083; Sat, 8 Mar 2025 16:34:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E41F6B0085; Sat, 8 Mar 2025 16:34:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 116796B0082 for ; Sat, 8 Mar 2025 16:34:05 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0D2FEC1E19 for ; Sat, 8 Mar 2025 21:34:06 +0000 (UTC) X-FDA: 83199686892.12.6D3AFE3 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf29.hostedemail.com (Postfix) with ESMTP id 67525120007 for ; Sat, 8 Mar 2025 21:34:04 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lQp7L3ln; spf=pass (imf29.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741469644; 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=xhuiurOtul+BSqt237fm7KAsqlkjsTHVffF1jM8JOUA=; b=7uKF7lyRfYPZf//d2SCXRbAwlCLxUP3+Jxxl5VI+7Bl3kqjVUGQCncnMFWROJ1bJsfLWBA Ci/seLtocR7+UH5137aGj5XVpPIOZw3V9J24d2UzHOeHRwn5nTrSoJD8mI/DPsb7Ev1y8N KDG68Vw0kEyOdUXH6EdRLwmVqPmRhlo= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lQp7L3ln; spf=pass (imf29.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741469644; a=rsa-sha256; cv=none; b=bjBqrcwc/Xl5dyvyWqM0l8ba1XOWONhKyuumhzWczvrcKpGh9zAmgWGJFCsFnOd8Eo4y9a NpZvA/z+j3p7kCzUaVY6zs6NQSM3BpdfjPpkwxBYuMBBZ7i8rDAX7dm6va6QZ97vpARm1S 9rfzonDGILFaqsyMItGBfc0to2Dlj0o= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 216D4A459D7; Sat, 8 Mar 2025 21:28:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07C26C4CEE0; Sat, 8 Mar 2025 21:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741469643; bh=D3enNDD6IJ9h5WbzvlwGVYrpzdUfItJAPQgFApHCcXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQp7L3lnRvKN3sS1evrXBI53w7bgUXY37xeFolN7N5OzCNV93cQeh+HkdKAllfc5P rUDnCBqOwpjubbd5si4dsVh7eG+r/JO+A85CdDpdl4f58vKwATa+NzfpjEbpGO+B4B Z5G5v6Aq/yRIqsYQ7eep/I2dosIaI+2JsGH/6F2hPZfp/Zmp2S1PCRc5P9kaN0PPe2 M5CRw/z0XQ7rrZvlV2w/jsZHxZhRq3MEXhnkKhovQhP9zwdvbAL4e+D2bY3fKQLWKj Ek54OrDIoljN4906DppDy5Mesd+S2F2MHyg56+ywGVI69oZMnohV/WfmQIOesZ2dCr bqKWybEGFsCfA== From: SeongJae Park To: Zi Yan Cc: SeongJae Park , Andrew Morton , Baolin Wang , Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Hugh Dickins , Kairui Song , Miaohe Lin , linux-kernel@vger.kernel.org, David Hildenbrand , John Hubbard , Kefeng Wang , "Kirill A. Shuemov" , Ryan Roberts , Yang Shi , Yu Zhao Subject: Re: [PATCH v3 1/2] mm/filemap: use xas_try_split() in __filemap_add_folio() Date: Sat, 8 Mar 2025 13:34:00 -0800 Message-Id: <20250308213400.10220-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20A1553F-C30A-4D93-8A43-011163A22C60@nvidia.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 67525120007 X-Stat-Signature: 49qaesddkmak3rxed3kbbkud9f881xr6 X-Rspam-User: X-HE-Tag: 1741469644-7823 X-HE-Meta: U2FsdGVkX1/hIFz2Y94XouMVazatSQ8XFrVTBV+PbZZB0F4lgVC5mlr7kJb7YgYyHC0+9gTHk8EVmQVXHxys16r9qBpIvtIp2uJggwWfXjzpLS0/neIB9HUcQAUfztVAYSNdywKg7IxJJU74y7SmJc5BF6to9Hg9tcLG47BCIz08slulT+secV+vjjlF9apQjTmmX8V711as40KyL+ImwY6GL6HRIPibfisqh5oH2pOqh4TUusw3NK/HuHpXJovVzM0y8L3O0oijwg+kaVQhFfZnsv6o9QxIq8B2h/PdFn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4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sat, 08 Mar 2025 13:32:02 -0500 Zi Yan wrote: > On 8 Mar 2025, at 13:14, SeongJae Park wrote: > > > Hello, > > > > On Wed, 26 Feb 2025 16:08:53 -0500 Zi Yan wrote: [...] > >> diff --git a/include/linux/xarray.h b/include/linux/xarray.h > >> index 4010195201c9..78eede109b1a 100644 > >> --- a/include/linux/xarray.h > >> +++ b/include/linux/xarray.h > >> @@ -1556,6 +1556,7 @@ int xas_get_order(struct xa_state *xas); > >> void xas_split(struct xa_state *, void *entry, unsigned int order); > >> void xas_split_alloc(struct xa_state *, void *entry, unsigned int order, gfp_t); > >> void xas_try_split(struct xa_state *xas, void *entry, unsigned int order); > >> +unsigned int xas_try_split_min_order(unsigned int order); > >> #else > >> static inline int xa_get_order(struct xarray *xa, unsigned long index) > >> { > >> @@ -1582,6 +1583,12 @@ static inline void xas_try_split(struct xa_state *xas, void *entry, > >> unsigned int order) > >> { > >> } > >> + > >> +static inline unsigned int xas_try_split_min_order(unsigned int order) > >> +{ > >> + return 0; > >> +} > >> + > >> #endif > >> > >> /** > >> diff --git a/lib/xarray.c b/lib/xarray.c > >> index bc197c96d171..8067182d3e43 100644 > >> --- a/lib/xarray.c > >> +++ b/lib/xarray.c > >> @@ -1133,6 +1133,28 @@ void xas_split(struct xa_state *xas, void *entry, unsigned int order) > >> } > >> EXPORT_SYMBOL_GPL(xas_split); > >> > >> +/** > >> + * xas_try_split_min_order() - Minimal split order xas_try_split() can accept > >> + * @order: Current entry order. > >> + * > >> + * xas_try_split() can split a multi-index entry to smaller than @order - 1 if > >> + * no new xa_node is needed. This function provides the minimal order > >> + * xas_try_split() supports. > >> + * > >> + * Return: the minimal order xas_try_split() supports > >> + * > >> + * Context: Any context. > >> + * > >> + */ > >> +unsigned int xas_try_split_min_order(unsigned int order) > >> +{ > >> + if (order % XA_CHUNK_SHIFT = 0) > >> + return order = 0 ? 0 : order - 1; > >> + > >> + return order - (order % XA_CHUNK_SHIFT); > >> +} > >> +EXPORT_SYMBOL_GPL(xas_try_split_min_order); > >> + > > > > I found this makes build fails when CONFIG_XARRAY_MULTI is unset, like below. > > > > /linux/lib/xarray.c:1251:14: error: redefinition of ‘xas_try_split_min_order’ > > 1251 | unsigned int xas_try_split_min_order(unsigned int order) > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > In file included from /linux/lib/xarray.c:13: > > /linux/include/linux/xarray.h:1587:28: note: previous definition of ‘xas_try_split_min_order’ with type ‘unsigned int(unsigned int)’ > > 1587 | static inline unsigned int xas_try_split_min_order(unsigned int order) > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > > > I think we should have the definition only when CONFIG_XARRAY_MULTI? > > I think it might be a merge issue, since my original patch[1] places > xas_try_split_min_order() above xas_try_split(), both of which are > in #ifdef CONFIG_XARRAY_MULTI #endif. But mm-everything-2025-03-08-00-43 > seems to move xas_try_split_min_order() below xas_try_split() and > out of CONFIG_XARRAY_MULTI guard. You're right. I was testing this on the mm-unstable tree, more specifically, commit 2f0c87542d97. I confirmed the build failure goes away after moving the definition to the original place. > > [1] https://lore.kernel.org/linux-mm/20250226210854.2045816-2-ziy@nvidia.com/ > > -- > Best Regards, > Yan, Zi Thanks, SJ