lib/ratelimit.c

Source file repositories/reference/linux-study-clean/lib/ratelimit.c

File Facts

System
Linux kernel
Corpus path
lib/ratelimit.c
Extension
.c
Size
2960 bytes
Lines
106
Domain
Kernel Services
Bucket
lib
Inferred role
Kernel Services: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.

Dependency Surface

Detected Declarations

Annotated Snippet

if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
			m = ratelimit_state_reset_miss(rs);
			if (m) {
				printk_deferred(KERN_WARNING
						"%s: %d callbacks suppressed\n", func, m);
			}
		}
	}

	/* Note that the burst might be taken by a parallel call. */
	if (atomic_read(&rs->rs_n_left) > 0 && atomic_dec_return(&rs->rs_n_left) >= 0)
		ret = 1;

unlock_ret:
	raw_spin_unlock_irqrestore(&rs->lock, flags);

nolock_ret:
	if (!ret)
		ratelimit_state_inc_miss(rs);

	return ret;
}
EXPORT_SYMBOL(___ratelimit);

Annotation

Implementation Notes