Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1741791iog; Tue, 14 Jun 2022 12:14:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2XdxBBSlzm3Ef2mIxiknYroHOZHPlYw1G+xMxtgaoLU3no0fhdsZ4LH3hIT2nkb6XR+M/ X-Received: by 2002:a63:f942:0:b0:402:42f3:6200 with SMTP id q2-20020a63f942000000b0040242f36200mr5863024pgk.192.1655234058806; Tue, 14 Jun 2022 12:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655234058; cv=none; d=google.com; s=arc-20160816; b=zsJrWn6+RJF0zo3LfQT8dA1CLjSCHIMCwx0h34AMXRXVlpYxXny6au9hMEeZ8KXoB3 Zu66RIJcybTMIx7EzsjqylGHX74zun3t8BI9zMVk2l4TyDKLOIKkFmszI5+xT0DekKuX nDOCF+u5hrvtuGq5XBa9Nk3DiCU94WWGYtsA0hAK2UYmIunKk0IY0Zb5CgBCXnIQVKb1 v3wxB53fb5nRWYObiis0UNGehzFVTtT61+37r4EZFjAif9F/6KIts5lAqyO9s8jN1ZFk gPzISedCJqGHmS56GZA9msTx31qoN9SkMcA61sOgGL4ksTZ9JcunGUROY6YOpIOs5vwO ymMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KrRV//rtrccNkJBTlKhGHOF/oF+ni+3ESEuTSMEs8E4=; b=KJX7fsSht6E97pj4tu6r866fFFLO+ShWR5+KCp0JA0hM7xLbjvBvjvuVwVWJsZ74ua sPypIQ83apKB4An2W1vP6gpSV2nt1HtYURoQVhS8cCh405+Uuv94xTXhZKheA6g2igGB R4cUuf/liEauIKI1gpfBzxaHz4ZwP1BSDPOl/Rf+c1TAxwjKDr90wAvdvENxPSUd0a+3 jKns3O9PH4p594wN5OsJL6PSuGvUZ2+al+I5cqAfl2ZMi9rEBcGWMah80hEajmEkEfwp IFjCNTafNIagu5FpoyZsxhBR3ZSve7xRo+X774rPY7qQs6UC6rH5qtb7D/OBtdoq8Wvj mlbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iID+aUPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a170902c94f00b00153b2d16497si17693920pla.159.2022.06.14.12.14.06; Tue, 14 Jun 2022 12:14:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iID+aUPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349615AbiFNSKI (ORCPT + 99 others); Tue, 14 Jun 2022 14:10:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232143AbiFNSJz (ORCPT ); Tue, 14 Jun 2022 14:09:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 935163F8A6 for ; Tue, 14 Jun 2022 11:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655230193; h=from:from: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; bh=KrRV//rtrccNkJBTlKhGHOF/oF+ni+3ESEuTSMEs8E4=; b=iID+aUPxYzB6sycF+CGdpsS79LDBuvOzYosFSjOIEoz1d/IbV5mUuFf+AJ2GI/LDe6Tmw3 T834irk7cz8iFHxSgGrfAw4VM44o1UQvnuUCE4cueG8Qz2Hqy8FvPJyoyS8QCPuF1XtJks MuWQfmq40Qx7og5tjCNOcDT4qceQToQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-550-jt_LnJRONT2IvP9s2VjdPA-1; Tue, 14 Jun 2022 14:09:50 -0400 X-MC-Unique: jt_LnJRONT2IvP9s2VjdPA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0BC38804196; Tue, 14 Jun 2022 18:09:50 +0000 (UTC) Received: from bfoster.redhat.com (unknown [10.22.16.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D17EF492C3B; Tue, 14 Jun 2022 18:09:49 +0000 (UTC) From: Brian Foster To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ikent@redhat.com, onestero@redhat.com Subject: [PATCH 1/3] radix-tree: propagate all tags in idr tree Date: Tue, 14 Jun 2022 14:09:47 -0400 Message-Id: <20220614180949.102914-2-bfoster@redhat.com> In-Reply-To: <20220614180949.102914-1-bfoster@redhat.com> References: <20220614180949.102914-1-bfoster@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 The IDR tree has hardcoded tag propagation logic to handle the internal IDR_FREE tag and ignore all others. Fix up the hardcoded logic to support additional tags. This is specifically to support a new internal IDR_TGID radix tree tag used to improve search efficiency of pids with associated PIDTYPE_TGID tasks within a pid namespace. Signed-off-by: Brian Foster --- lib/radix-tree.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/radix-tree.c b/lib/radix-tree.c index b3afafe46fff..08eef33e7820 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -431,12 +431,14 @@ static int radix_tree_extend(struct radix_tree_root *root, gfp_t gfp, tag_clear(node, IDR_FREE, 0); root_tag_set(root, IDR_FREE); } - } else { - /* Propagate the aggregated tag info to the new child */ - for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { - if (root_tag_get(root, tag)) - tag_set(node, tag, 0); - } + } + + /* Propagate the aggregated tag info to the new child */ + for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { + if (is_idr(root) && tag == IDR_FREE) + continue; + if (root_tag_get(root, tag)) + tag_set(node, tag, 0); } BUG_ON(shift > BITS_PER_LONG); @@ -1368,11 +1370,13 @@ static bool __radix_tree_delete(struct radix_tree_root *root, unsigned offset = get_slot_offset(node, slot); int tag; - if (is_idr(root)) - node_tag_set(root, node, IDR_FREE, offset); - else - for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) - node_tag_clear(root, node, tag, offset); + for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { + if (is_idr(root) && tag == IDR_FREE) { + node_tag_set(root, node, tag, offset); + continue; + } + node_tag_clear(root, node, tag, offset); + } replace_slot(slot, NULL, node, -1, values); return node && delete_node(root, node); -- 2.34.1