Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1659963pxm; Fri, 4 Mar 2022 00:39:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbZXiHfQfUglT9PEXnPT6SS09/9GiEldxmE79E/V4P4bLHOguI6DeZi0YRNLGzi6D+6WNK X-Received: by 2002:aa7:85d7:0:b0:4de:91e0:3302 with SMTP id z23-20020aa785d7000000b004de91e03302mr42357676pfn.22.1646383182941; Fri, 04 Mar 2022 00:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646383182; cv=none; d=google.com; s=arc-20160816; b=WNZ9V+jEYnihzFzXaOmfri/T8ApaJAs9MlnwNZG4SheJhnSGUpj3pMuU0Tn5LTbNtc taYqo15kpqKd5acjmtP6JVCOa12o+HKVyKA7MgptFEc9R61hHQ6m5xdEqQWhAWkb9VB6 JID727rYKCazEDZgcRF4Y7zllm5tq+Syu9dzDoJlWO4WJsps8X76IDEsQQmi0vQmAKXN BiVDURfpJcMf4opuLZXWGe2PHWSUJqBMqdfQJWFy+GCSjFogw6s62c2NOPwGxwcLinqg uOtR4Q2MoAAIs6KhmrmqO6hR4pqyMAMi28vqm3KW7r72Rj44Q59tgSkYuqjtc0w4OusB g03g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=g+sewBM1Abiq2W6VJLDciAMQdmeYOLQPQfzlikon2S8=; b=U5WK42Lgp5Iujf4z9r1G9ansYJmDm8+847mn77enrJFCZazL3sJHgqalislwzpeKZj 9WjR+VAKVN9qWvExf78vZLrJfJdRCBx2aa95JgchDwMmmfA2y0vStIUKc2DNWZCaYpZJ a17RDR7yXa6a3om7cqNlZanKdd38LRlrKU4hlU7YK1Rlek5RRWIdxrnRq56V3nht1KhX 4O/1ABsisP1Jp8cj25o4fVpIwd3slKMy1FtglGcCTj0yYMiFUB1X837yA0p0Y+GdnHG8 w6RYEPCMJkwz+UlhDsZtBJptz/sE8D+wETbJW5VDsWbUkrCVRz9PyJoaFPAkVjW68Ra2 8bug== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr2-20020a17090b4b8200b001bf24f533acsi1830632pjb.3.2022.03.04.00.39.28; Fri, 04 Mar 2022 00:39:42 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237271AbiCCXj0 (ORCPT + 99 others); Thu, 3 Mar 2022 18:39:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235893AbiCCXjZ (ORCPT ); Thu, 3 Mar 2022 18:39:25 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B24BF3F31C; Thu, 3 Mar 2022 15:38:38 -0800 (PST) X-UUID: e9352919be7d4247b49524b61b6ece65-20220304 X-UUID: e9352919be7d4247b49524b61b6ece65-20220304 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 775196386; Fri, 04 Mar 2022 07:38:33 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Fri, 4 Mar 2022 07:38:32 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 4 Mar 2022 07:38:32 +0800 From: Miles Chen To: CC: , , , , , , , Subject: Re: [PATCH] iommu/iova: Improve 32-bit free space estimate Date: Fri, 4 Mar 2022 07:36:46 +0800 Message-ID: <20220303233646.13773-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <033815732d83ca73b13c11485ac39336f15c3b40.1646318408.git.robin.murphy@arm.com> References: <033815732d83ca73b13c11485ac39336f15c3b40.1646318408.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 Hi Robin, > For various reasons based on the allocator behaviour and typical > use-cases at the time, when the max32_alloc_size optimisation was > introduced it seemed reasonable to couple the reset of the tracked > size to the update of cached32_node upon freeing a relevant IOVA. > However, since subsequent optimisations focused on helping genuine > 32-bit devices make best use of even more limited address spaces, it > is now a lot more likely for cached32_node to be anywhere in a "full" > 32-bit address space, and as such more likely for space to become > available from IOVAs below that node being freed. > > At this point, the short-cut in __cached_rbnode_delete_update() really > doesn't hold up any more, and we need to fix the logic to reliably > provide the expected behaviour. We still want cached32_node to only move > upwards, but we should reset the allocation size if *any* 32-bit space > has become available. > > Reported-by: Yunfei Wang > Signed-off-by: Robin Murphy Would you mind adding: Cc: to this path? I checked and I think the patch can be applied to 5.4 and later. thanks, Miles