From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (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 7F2C7416126 for ; Tue, 7 Jul 2026 13:13:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783430037; cv=none; b=QX8/iADnJGQpQW7tt9hxFd3YvrwZRTrNZkcwRWYx2niO2VBU2PENbs/fBpKhzEgXXIgDhAx4uYYfCKbmCltNNZARUBoLs96cTezGmK160UcLbKkkK1lNyUAv3ZyqG/qGfss75Rx3wrHx2+IXNsWgz49sbMaONOiGfEtquzF2nj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783430037; c=relaxed/simple; bh=GK7PFm99L/4DqOi76pFbPZ1OFtxYFfFssnW7d/gf0aE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=R3WaRSxDltsKOMoa3gEXM6PMWcfw7gBbxWTqyGGaidThIbfP0goE8T0JCCT7510hSKNCkKfdUlh7A/FQcShIx7oFkOeXvRX4PHo5KxFQG6ZYZKWlBOhrkDkrOxUYr1qtvwI0YFzNZ9wW1xl5x3jLudFRUD5/nGrbg8G2O5/er68= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CN3NJ2NQ; arc=none smtp.client-ip=209.85.221.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CN3NJ2NQ" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-4740be00302so3426650f8f.2 for ; Tue, 07 Jul 2026 06:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783430035; x=1784034835; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:from:to:cc :subject:date:message-id:reply-to:content-type; bh=GK7PFm99L/4DqOi76pFbPZ1OFtxYFfFssnW7d/gf0aE=; b=CN3NJ2NQIjlDv+RNZT72ZEeQBiYsC5bkgwe7NGP+wQDNzzFqvnDz8GiixF60Z5QUon ElB/RTvYhpDFIqiQNgliFke7cH7tbmhyztSHSv+smCbHtwiX6anGuXNMuqVpEOV4ZuUC luEb+TDVxeb4Xzyjj1rPoVU0MV5NKjvkpe46Uj3lldQ1OaUUTFM34gMjN50BzaGEgYT2 1LA0hfxd+kQimHQAmRo0YdhgUYF9qTgL1XpDLqPZj1ZcDRZ9NyI6Dy/wo3Ck1vSt8Hpg 13kCKfw7pjNd2JyXOAJCWn8J5XwjMMZlXwhWa9ZDbLG5Tyvv9FKyNGOGoWPWRm54+cs6 TAXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783430035; x=1784034835; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=GK7PFm99L/4DqOi76pFbPZ1OFtxYFfFssnW7d/gf0aE=; b=B7tklvQiwqNDUp5cRNYXIwYniTWy0PRYaKJ94fvVEzSNlusyB3zWRJTfSTIW3guvCJ 7FQCHIZ2f9gy6HyFBTKpAOEuyM1hYXyQdzCzYI+WG7LLm/v2eHJiqV76uYq9THcy1zbW k3and7RT+6f+kVfgaAuRG3KnmNrl9XX+lavh2ucirdJd7F5E7O1hzOBHVlyjhAvakuOf uEnwuHqejPiT9HzXFv9qv939HqUfojfSXJU1Wo6D30qy9hrwHtZ4KHCJphg4TRBrEk9w Z043OzSuzvY9WRWs+m4zjioyY9wI8SCuSSc68zNKmuC7HTlPJoxdd8CVzuiijR+3w8Oy KLoQ== X-Forwarded-Encrypted: i=1; AHgh+RrVo7kzC2NyZFRlxGCG14hwpM2yBLOF7hEW7tdiMuk6fzbi/1Lss957aKZez/H/XsFNB5Wp3rm9T6CJmzg=@vger.kernel.org X-Gm-Message-State: AOJu0YxJ7iM2BVkIpyaiKtJ6aBS0TyVmM6zUNg3eTxYEQpZkra9OcKSk IACIBto2zP97oZja5S70W04uLLdw6GfcSJTIV0boPv2NcDyNYpliOjVbyedXv0+m9GttODm2FJH KS3sO9G2IbZdKxFYz4g== X-Received: from wrmc5.prod.google.com ([2002:adf:e705:0:b0:465:767a:3a41]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a5d:53c8:0:b0:477:6da:1b83 with SMTP id ffacd0b85a97d-47de669f408mr4204803f8f.24.1783430033658; Tue, 07 Jul 2026 06:13:53 -0700 (PDT) Date: Tue, 7 Jul 2026 13:13:52 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260623-pr-ratelimited-v1-0-cc922f544dc0@google.com> <20260623-pr-ratelimited-v1-3-cc922f544dc0@google.com> Message-ID: Subject: Re: [PATCH 3/5] rust: add pr_*_ratelimit! macros for printing From: Alice Ryhl To: Alvin Sun Cc: Greg Kroah-Hartman , Carlos Llamas , Boqun Feng , Gary Guo , "Onur =?utf-8?B?w5Z6a2Fu?=" , Andreas Hindborg , Benno Lossin , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Daniel Almeida , Danilo Krummrich , Ingo Molnar , Lyude Paul , Miguel Ojeda , Peter Zijlstra , Trevor Gross , Waiman Long , Will Deacon , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, Jul 02, 2026 at 02:15:35PM +0800, Alvin Sun wrote: >=20 > On 6/23/26 23:38, Alice Ryhl wrote: > > Printing can be very expensive if it occurs often, so printing that can > > be triggered by userspace should be rate limited. For this purpose, add > > a Rust wrapper around `struct ratelimit_state` and use it in the new > > macros. > >=20 > > Signed-off-by: Alice Ryhl >=20 > Tested-by: Alvin Sun >=20 > The binder-related patches couldn't be applied to the mainline > repository. I wrote a simple misc device to test pr_warn_ratelimited: >=20 > [=C2=A0 =C2=A080.655483] misc misc_test: Opening Rust Misc Test Device > [=C2=A0 =C2=A080.655546] Rust: 1990 callbacks suppressed > [=C2=A0 =C2=A080.656102] rust_misc_test: pr_warn_ratelimited triggered (0= ) from > /dev/misc_test > [=C2=A0 =C2=A080.656137] rust_misc_test: pr_warn_ratelimited triggered (1= ) from > /dev/misc_test Thanks! Alice