restore lost packages from 0.2.3 + fix overwritten 0.2.4 files
- Restore 29 recipe symlinks (libdrm, qtbase, dbus, sddm, pipewire, etc.) - Restore 33 patches (KDE, libdrm, mesa, pipewire, sddm, wireplumber) - Restore 20+ local/scripts (audit, lint, test, build helpers) - Restore src/cook/scheduler.rs, status.rs, gnu-config/ - Restore scripts/patch-inclusion-gate.sh, run_mini1.sh, validate-collision-log.sh - Recover TLC source from HEAD (was overwritten by 0.2.3 checkout) - Recover 11 local/docs plans from HEAD (were overwritten) - Recover qt6-wayland-smoke symlink from HEAD - Fix MOTD: remove garbled ASCII art, use clean text - Update version: 0.2.0 -> 0.2.4 in os-release, motd, config - Reduce filesystem_size: 1536 -> 512 MiB - Add ABSOLUTE RULE to AGENTS.md: never delete/ignore packages - Reduce pcid scheme log verbosity: info -> debug
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
/* 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 */
|
||||
Reference in New Issue
Block a user