Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6179580rwb; Wed, 18 Jan 2023 02:06:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXt7fuznjAq56nbxqhVxPtsbqhPgBCthYB7fMx0tPRmFku7OGXyrKCKF1iysCwBeX9z+s5ey X-Received: by 2002:a17:906:ce23:b0:870:c363:599d with SMTP id sd3-20020a170906ce2300b00870c363599dmr6541861ejb.51.1674036365618; Wed, 18 Jan 2023 02:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674036365; cv=none; d=google.com; s=arc-20160816; b=bX6Re3WAtJ4tmZvje89sHXiSzc+jfHriK6gJwwt9+75uLPHigMYwvxNkcLSRmZcFMJ a5AFBkqzDDEu1bXnQd3FGWtQe2PY30TunVtC5idZ7CvvgW6scEfEmxCBuikuetmd20Qg q5Idi5MVBZTQpJVrsXs9wgr/3TVoFeEHLmJBfG60ZDy+Ead7VfqMMJeShkCDQEp22+qT a9gSp0y53ZFLmmNm4wBhfnA9Is8+z5y5x7W+c3wVkONdqI5/Suy6EWz5eE2t12DDWdM0 Dq+fk2nHOa025kOBVz6QNzk/VjXBu3V1XyrpQjjq9/IXY9lB11jQ17gkpVDzulSdORmx hU9Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Z0FlUTai4MYuXf66nWeSSsrMheoOYLLtmq1UJa2+en4=; b=D9+4zYhhJGeT486FbCIOt5V7maR4sDkTMliRVhI/A9NxExO6RVP75QWPeYh60afBbK QWu7Z6PXTXaqV/tLRvapj0nKgUs0dNH/0cfEiGMZMjIkO37o7WV53s7tujPfbebUKKDB sDE7NYvlgNnCuCN/3tE3CZhhvQUlgz4CPG+bMescybBRmUofRPgupiZ5jDfk3gg48Ev7 vqfDzMZHPrfNwBKo2BiO0oVAyBOBAEvcTRdNczOfQkpX0G0bx5weAjH7SvzZpf+W5TYf nWIuEdr1NpjpqeBrb+D8co/2pcBb8MvJ8lUExtDNwEFGqXwAHLOWaKXIFq/+NqAfa32q qvnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hE9uf9tA; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bb7-20020a1709070a0700b0084d4a07de68si30075215ejc.477.2023.01.18.02.05.54; Wed, 18 Jan 2023 02:06:05 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hE9uf9tA; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229507AbjARIzc (ORCPT + 45 others); Wed, 18 Jan 2023 03:55:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbjARIwj (ORCPT ); Wed, 18 Jan 2023 03:52:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E71EB5AA4F; Wed, 18 Jan 2023 00:07:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A148EB81B3E; Wed, 18 Jan 2023 08:07:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2522C433D2; Wed, 18 Jan 2023 08:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674029233; bh=jV7i9GOJFI/Ud+m8L/XR9u5kzqRqvbbtkxuVTnegFv0=; h=From:To:Cc:Subject:Date:From; b=hE9uf9tA9pYO+pI66/xY5O8+jR+zScqB63M3U6aiTPIAe1bwEzMc5i+1ivbvdYs8C Y/NoVnKf6GSXY6DmNtXLL4WutHYj2zCjiy9q9zxjgrBaHX44DOd0ym+L63Z0kr54AN uChgkqEihIGa9nIoOMWtS/qJCBpC8iEYmTq7BipJKGEUHhnYs1Yw9BERk97XugR8+P D8JHi4jthfx/TajyRznKPg8X9J6MV6SzVBWukSRwkeO+TClzAywpoK6izRxeZsVvNV O9RzDY6EQnSELfSMmuOsjcagdPrNhauThPFk+Azop9nDovIJ6gZoYMfbc5HQgb+3iz i1t2zSYZ5Jw8A== From: Arnd Bergmann To: Tejun Heo , Josef Bacik , Jens Axboe Cc: Arnd Bergmann , Kemeng Shi , Andreas Herrmann , Yu Kuai , Chengming Zhou , Jinke Han , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] blk-iocost: avoid 64-bit division in ioc_timer_fn Date: Wed, 18 Jan 2023 09:07:01 +0100 Message-Id: <20230118080706.3303186-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Arnd Bergmann The behavior of 'enum' types has changed in gcc-13, so now the UNBUSY_THR_PCT constant is interpreted as a 64-bit number because it is defined as part of the same enum definition as some other constants that do not fit within a 32-bit integer. This in turn leads to some inefficient code on 32-bit architectures as well as a link error: arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: block/blk-iocost.o: in function `ioc_timer_fn': blk-iocost.c:(.text+0x68e8): undefined reference to `__aeabi_uldivmod' arm-linux-gnueabi-ld: blk-iocost.c:(.text+0x6908): undefined reference to `__aeabi_uldivmod' Split the enum definition to keep the 64-bit timing constants in a separate enum type from those constants that can clearly fit within a smaller type. Signed-off-by: Arnd Bergmann --- block/blk-iocost.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 6955605629e4..b691b6bb498f 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -258,6 +258,11 @@ enum { VRATE_MIN = VTIME_PER_USEC * VRATE_MIN_PPM / MILLION, VRATE_CLAMP_ADJ_PCT = 4, + /* switch iff the conditions are met for longer than this */ + AUTOP_CYCLE_NSEC = 10LLU * NSEC_PER_SEC, +}; + +enum { /* if IOs end up waiting for requests, issue less */ RQ_WAIT_BUSY_PCT = 5, @@ -296,9 +301,6 @@ enum { /* don't let cmds which take a very long time pin lagging for too long */ MAX_LAGGING_PERIODS = 10, - /* switch iff the conditions are met for longer than this */ - AUTOP_CYCLE_NSEC = 10LLU * NSEC_PER_SEC, - /* * Count IO size in 4k pages. The 12bit shift helps keeping * size-proportional components of cost calculation in closer -- 2.39.0