Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2376446rdh; Sun, 29 Oct 2023 13:12:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGItD0vfODYY9UkWDwMhiImM+BaFTws0pV/cxc4Ywap5+vsM3x26x8CS3PMPskR6Y1dCaSU X-Received: by 2002:a05:6a21:19b:b0:154:d3ac:2076 with SMTP id le27-20020a056a21019b00b00154d3ac2076mr7587622pzb.40.1698610325898; Sun, 29 Oct 2023 13:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698610325; cv=none; d=google.com; s=arc-20160816; b=byId1DlLcIvmFKCT+AkAXLWGC/S9eEtPexQShC9/DIjqrykSlylbSocoVl4VtiiWEU oc7EoF0V8smYkdaxLtfC0QIrdYtie4D2h8CbwBWvbiJjl50sEsTn2xxUG4Bx7nvcPfSZ Lj5NXAHjtIwf8OfXnbByb0RWjiSoNaSFhqXSdQIy8fTTqG7kmXToQH00PmBS3phkkxqo uGPdxr55aWetbWJUBhMK4Fq+ebRey/qJzqGkCdoTBS/cjhF8E0nuPfP4unDiRigqwvyZ Kzwk9Jw0sr7tJfvOuGY3JqVdEOM5oOnuQJsgNGgaExDLAURE3U0BCq4toFZ7z+O4mPUI 69Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NHrqX2dC2lEhCtw3IxHryPs6MHyo/+ZGBHAb3HIxQc4=; fh=ardmABoZqyzAm25ow9fvqe18o8v8L1P0+Wo2I9sPHpg=; b=DdojP04wtppiWyAgCHA7cSxKEEPKw2y0oUpd5eDFWPLvhZS3cApTUS1+HgMu71axfY g26lS+GI8INmLfJLftsy+frtJktn3i+mURJmtay68xOz+zoDROcDY3NDLvt0zo8wc0bU waHr4CjndPaRvRqMm5II93PBGX5Kc5uTQ8nGcVdyXZg5GV8Lh/xMCKKN1fZ727c/zate x81NUjbm5a47+6kMMMh4el6dSRI9irzOR1yXabe6Hzfc53reNYjawsqwrMPskteVr7lj TcndtsZuqDCeWMbwPT5sZaUgPqS+kOZroQempXczlmtQQe/9SFoweFsJhfNaeK9qcC/1 Lk7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="H4Yk/YOz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id o5-20020a170903300500b001cc3527145bsi2050583pla.29.2023.10.29.13.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:12:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="H4Yk/YOz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D094A8061B57; Sun, 29 Oct 2023 13:11:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbjJ2ULt (ORCPT + 99 others); Sun, 29 Oct 2023 16:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjJ2ULr (ORCPT ); Sun, 29 Oct 2023 16:11:47 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59A13AC; Sun, 29 Oct 2023 13:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NHrqX2dC2lEhCtw3IxHryPs6MHyo/+ZGBHAb3HIxQc4=; b=H4Yk/YOzLJ3l9KWC52qtmtxpFo dJ57w9BQ35z8V72QCTvP1nJSapmZxeQDHMsiAyzO/EtGniTRnuI5D7z5QoG6PmWimkfRDSxnuM5H6 lbjX0G8iBUW3ct7sl/MxKhuLLSMo3HLSB953r48DiSFyz2IImBg/sYyWH4bB8Inq0v601G9jpihOU 5/PMxD0OQiymEXQ8dRl8bHgQ5rlFpE7zqOBnmL6IySER6oUs1o2/IQn6GNMcnj3vtZf6eZpLjDVyy sElUCa6DvWTJOlYziHJcF97elZewKiEP1ZSZ0o7x6MYB0T5px8sC1LDii5bIA5E50oMAh2TOGZ2/R 2xX+w1NA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qxC8C-00HTDK-E7; Sun, 29 Oct 2023 20:11:32 +0000 Date: Sun, 29 Oct 2023 20:11:32 +0000 From: Matthew Wilcox To: Daniel Gomez Cc: "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "hughd@google.com" , "akpm@linux-foundation.org" , "mcgrof@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "gost.dev@samsung.com" , Pankaj Raghav Subject: Re: [RFC PATCH 01/11] XArray: add cmpxchg order test Message-ID: References: <20230919135536.2165715-1-da.gomez@samsung.com> <20231028211518.3424020-1-da.gomez@samsung.com> <20231028211518.3424020-2-da.gomez@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231028211518.3424020-2-da.gomez@samsung.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 29 Oct 2023 13:11:54 -0700 (PDT) On Sat, Oct 28, 2023 at 09:15:35PM +0000, Daniel Gomez wrote: > +static noinline void check_cmpxchg_order(struct xarray *xa) > +{ > + void *FIVE = xa_mk_value(5); > + unsigned int order = IS_ENABLED(CONFIG_XARRAY_MULTI) ? 15 : 1; ... have you tried this with CONFIG_XARRAY_MULTI deselected? I suspect it will BUG() because orders greater than 0 are not allowed. > + XA_BUG_ON(xa, !xa_empty(xa)); > + XA_BUG_ON(xa, xa_store_index(xa, 5, GFP_KERNEL) != NULL); > + XA_BUG_ON(xa, xa_insert(xa, 5, FIVE, GFP_KERNEL) != -EBUSY); > + XA_BUG_ON(xa, xa_store_order(xa, 5, order, FIVE, GFP_KERNEL)); > + XA_BUG_ON(xa, xa_get_order(xa, 5) != order); > + XA_BUG_ON(xa, xa_get_order(xa, xa_to_value(FIVE)) != order); > + old = xa_cmpxchg(xa, 5, FIVE, NULL, GFP_KERNEL); > + XA_BUG_ON(xa, old != FIVE); > + XA_BUG_ON(xa, xa_get_order(xa, 5) != 0); > + XA_BUG_ON(xa, xa_get_order(xa, xa_to_value(FIVE)) != 0); > + XA_BUG_ON(xa, xa_get_order(xa, xa_to_value(old)) != 0); > + XA_BUG_ON(xa, !xa_empty(xa)); I'm not sure this is a great test. It definitely does do what you claim it will, but for example, it's possible that we might keep that information for other orders. So maybe we should have another entry at (1 << order) that keeps the node around and could theoretically keep the order information around for the now-NULL entry?