Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp2018043lqp; Tue, 16 Apr 2024 05:17:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5nohK+KU9op7MFVnfOmkyMcFxRxXExsgrs/GvtMUI0vtSmoi3xVrzoeEBHklYdJHXGj38khHZIzvM2JBMhVPtPXJGGJN4bmVU5BXn/Q== X-Google-Smtp-Source: AGHT+IE0eqrz48jzE6vU5PwEQyP/UdCkJMHoEeurzLTrS2y2XbrtyzN1FK9SV9jjeha+A1WMv/Ir X-Received: by 2002:a17:90b:4012:b0:2a6:7b6f:3777 with SMTP id ie18-20020a17090b401200b002a67b6f3777mr9741457pjb.2.1713269837274; Tue, 16 Apr 2024 05:17:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713269836; cv=pass; d=google.com; s=arc-20160816; b=d5sqRXU3aaR/JOOZNhqA3wqZnoCVfkjtfd1WblD5TDyEvVKaP1BhXuFGQbxQWbxHzt 4Kyt5UZCUG85FC2HB8/hf+oGLESiAcsXzfj715X6p2G6UPdI6EsicBP+ijxBiChKFPjD 46OAsi+8mU5FHChtMbz6WqOvUywbYpwbt6Y7eGTr0AfeafHhN72FksS6Sp+hBtNz5tN2 9WSfDVbB1CWG0YfUkJGTlaQ9W2DPVEww+QOtTj6I+wEyQSTwfXSEkxxy0rUdqBmVTbRu LAto64AYbTENC4M2LuMKfXgF2XpUyJ0dNKl0PrALWfnauUNBaDPFzEppFHDM2sneA7+v gHvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tn8L7Kj7xLJGqKx7jb5AwYrGu1BZjVWnoiTJPrrq0So=; fh=eDxpG5bT59QkvYs1FM0EoP/fOyleWVXt1wvOiWFp3w8=; b=ZBlaM0NWUNDXmoxpm6roUxtSWnagvh3rHid3I1R7/Y29zAu016gm73xkvTXShbxNM0 Vd2rNw0PNiMZABpbFTyR5xhY2g56jjNO6nepnhpOvDjWvX9JtT6KglWVkwJKyONteDsH Nlx4XIOEL5cCifnIVtdRcDfcTMBKqTtplhDZ1akXKN3dZ0DzPGZglCSRtmuv7ip1PLwq TZzwTiMn1wxX/2w5Gpvk3J6y6A3dbsHrrLS9toH91GjpwPc3XA1J6IsbN1lueXqrTbbd sZ/IUQp1zv5Bq09VTKGzaIZa4ASTHA4s3qjcGOU1PaUPLn/1TuRICmqfabEe/jdBhqFh tXBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=owORLR12; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-146764-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146764-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id gf3-20020a17090ac7c300b002a52c195c06si11959866pjb.28.2024.04.16.05.17.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:17:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146764-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=owORLR12; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-146764-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146764-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BF6A2B21618 for ; Tue, 16 Apr 2024 12:16:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A88BC12C496; Tue, 16 Apr 2024 12:15:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="owORLR12" Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1715F12BF29 for ; Tue, 16 Apr 2024 12:15:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713269742; cv=none; b=jdJyo733QkCfCRwB+f/qHw8ChSuwesKqprquSqMspWdLQs6y05btbXrOhmoGQ4iUUlj9d69LBBWJuXI1D4jwzVUZn/Qn51enkNkKAEM+03YrftHZNzQq7hj5uL7sW9l59IHgEtn8d/910nXMnU2/2KTjCAFcLyyI4/8DMhRXqkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713269742; c=relaxed/simple; bh=RG9FrqpOf7WbjmJJz8QqVZnfuVsS9/NaC14Fu5Zb+ig=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JL2W9G2pO16WU1uBnI4AG4YGqIwtmXEl0IvYw3eixBbP30hCoHTO8bZB2xpOPkZWYLWCacTbMLQiMw/GtcMg/RZKO7JN5hztNiamVQ7s45z0ZIKgj6ttCvohboqP8Y2i08KEl9CA8yPKVrJySYG2+r/B4NoY8F1XBCEtbR/MkxM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=owORLR12; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-5f0a485dab9so372451a12.1 for ; Tue, 16 Apr 2024 05:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1713269738; x=1713874538; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tn8L7Kj7xLJGqKx7jb5AwYrGu1BZjVWnoiTJPrrq0So=; b=owORLR12QMVsGgrsVx6FgVXKUof0kex0BiBBje+9s49yFD+aoPWbi2cDhDAhp1P8OH KIPlXKT9BI/dZWskUBTCATE42I5fDvq8u0sbjhlB3r9EHbrD836xfrabIWVAldH1x/re TCMxDWfhGawMR/XOZbFMrLrs4gz2xY3eFGoKY0UT4hOic8duXKKRuBpaoppc09RzbbrC +2kO8xZN4d2yqNhdjQEDR9K9drltQBOjOgx9MRp0ecJwK9ttw21Pc87Wob1s3kYb2GOF bB5zgBUSAPMwxLs08aBVBAoSIKVMHq+U5Hy2jq1i4IN+iXXNVCMB4qhEJZRLeJY5WRge Liag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713269738; x=1713874538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tn8L7Kj7xLJGqKx7jb5AwYrGu1BZjVWnoiTJPrrq0So=; b=MkAUuZKO4UAyYPT3BbJjvTVJSiqn31Aja6hf+Jgbh7OdkRg4PpPHMXt0Z3WYIJZljI 9d5sgwknDLio3kwLCapiFPsk2vKJmx/t3/86h3kUGDsxhvdiW5k5doFVuL3VGioYHJ8t dXTaCy9CSduSv4W5aKh/G4GEZlLX4Mld6e4GJjhiUK+JL9+4X5mmHGruVuCdf5LWrAbS ir7R2PcxiBCQGgNhMgYpxroco1IEry7IPGWOLZ6vvcZBIFGgGjEL0ZrGevjeti8A27rY 3iWSMqJc1E4c8X/O0HUEy8WrCIv+pBsl7cvHDWdjka8SNGtBGmCsTLuaGJCbk8Xi0wwo vJTw== X-Gm-Message-State: AOJu0Yymy1ospmyoOxArVoDFkH4CnW8Q6od4OXeJDttPxHVd/2XSBslV /rru468pPvmIanErPh83e44e23XLIp52c8ZjhaHXEdf/vwhahMnndAHXS05T8MEmV0sIehP3xXc h X-Received: by 2002:a17:902:e84d:b0:1dd:da28:e5ca with SMTP id t13-20020a170902e84d00b001ddda28e5camr14826585plg.0.1713269737731; Tue, 16 Apr 2024 05:15:37 -0700 (PDT) Received: from localhost.localdomain ([198.8.77.194]) by smtp.gmail.com with ESMTPSA id d12-20020a170903230c00b001e43576a7a1sm9584693plh.222.2024.04.16.05.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:15:36 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: peterz@infradead.org, tglx@linutronix.de, Jens Axboe Subject: [PATCH 3/4] sched/core: have io_schedule_prepare() return a long Date: Tue, 16 Apr 2024 06:11:20 -0600 Message-ID: <20240416121526.67022-4-axboe@kernel.dk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240416121526.67022-1-axboe@kernel.dk> References: <20240416121526.67022-1-axboe@kernel.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In preparation for needing more state then 32-bit on 64-bit archs, switch it to a long instead. Signed-off-by: Jens Axboe --- block/blk-cgroup.c | 2 +- include/linux/sched.h | 4 ++-- kernel/locking/mutex.c | 4 ++-- kernel/locking/rtmutex_api.c | 4 ++-- kernel/sched/core.c | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index bdbb557feb5a..77faceddd5dd 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1849,7 +1849,7 @@ static void blkcg_maybe_throttle_blkg(struct blkcg_gq *blkg, bool use_memdelay) u64 now = blk_time_get_ns(); u64 exp; u64 delay_nsec = 0; - int tok; + long tok; while (blkg->parent) { int use_delay = atomic_read(&blkg->use_delay); diff --git a/include/linux/sched.h b/include/linux/sched.h index 3c2abbc587b4..dcfc2830ed8e 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -317,8 +317,8 @@ asmlinkage void preempt_schedule_irq(void); extern void schedule_rtlock(void); #endif -extern int __must_check io_schedule_prepare(void); -extern void io_schedule_finish(int token); +extern long __must_check io_schedule_prepare(void); +extern void io_schedule_finish(long token); extern long io_schedule_timeout(long timeout); extern void io_schedule(void); diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index cbae8c0b89ab..4a86ea6c7f19 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -830,7 +830,7 @@ EXPORT_SYMBOL_GPL(mutex_lock_interruptible_nested); void __sched mutex_lock_io_nested(struct mutex *lock, unsigned int subclass) { - int token; + long token; might_sleep(); @@ -1026,7 +1026,7 @@ EXPORT_SYMBOL(mutex_lock_killable); */ void __sched mutex_lock_io(struct mutex *lock) { - int token; + long token; token = io_schedule_prepare(); mutex_lock(lock); diff --git a/kernel/locking/rtmutex_api.c b/kernel/locking/rtmutex_api.c index a6974d044593..ddf7f7f3f0b5 100644 --- a/kernel/locking/rtmutex_api.c +++ b/kernel/locking/rtmutex_api.c @@ -547,7 +547,7 @@ EXPORT_SYMBOL_GPL(mutex_lock_killable_nested); void __sched mutex_lock_io_nested(struct mutex *lock, unsigned int subclass) { - int token; + long token; might_sleep(); @@ -579,7 +579,7 @@ EXPORT_SYMBOL(mutex_lock_killable); void __sched mutex_lock_io(struct mutex *lock) { - int token = io_schedule_prepare(); + long token = io_schedule_prepare(); __mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, 0, NULL, _RET_IP_); io_schedule_finish(token); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 6a6c985220b1..63f6d44f460c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -9032,16 +9032,16 @@ int __sched yield_to(struct task_struct *p, bool preempt) } EXPORT_SYMBOL_GPL(yield_to); -int io_schedule_prepare(void) +long io_schedule_prepare(void) { - int old_iowait = current->in_iowait; + long old_iowait = current->in_iowait; current->in_iowait = 1; blk_flush_plug(current->plug, true); return old_iowait; } -void io_schedule_finish(int token) +void io_schedule_finish(long token) { current->in_iowait = token; } -- 2.43.0