25763b3c86
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of version 2 of the gnu general public license as published by the free software foundation extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 107 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Steve Winslow <swinslow@gmail.com> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190528171438.615055994@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33 lines
1.0 KiB
C
33 lines
1.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* Copyright (c) 2016 Facebook
|
|
*/
|
|
#ifndef __PERCPU_FREELIST_H__
|
|
#define __PERCPU_FREELIST_H__
|
|
#include <linux/spinlock.h>
|
|
#include <linux/percpu.h>
|
|
|
|
struct pcpu_freelist_head {
|
|
struct pcpu_freelist_node *first;
|
|
raw_spinlock_t lock;
|
|
};
|
|
|
|
struct pcpu_freelist {
|
|
struct pcpu_freelist_head __percpu *freelist;
|
|
};
|
|
|
|
struct pcpu_freelist_node {
|
|
struct pcpu_freelist_node *next;
|
|
};
|
|
|
|
/* pcpu_freelist_* do spin_lock_irqsave. */
|
|
void pcpu_freelist_push(struct pcpu_freelist *, struct pcpu_freelist_node *);
|
|
struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *);
|
|
/* __pcpu_freelist_* do spin_lock only. caller must disable irqs. */
|
|
void __pcpu_freelist_push(struct pcpu_freelist *, struct pcpu_freelist_node *);
|
|
struct pcpu_freelist_node *__pcpu_freelist_pop(struct pcpu_freelist *);
|
|
void pcpu_freelist_populate(struct pcpu_freelist *s, void *buf, u32 elem_size,
|
|
u32 nr_elems);
|
|
int pcpu_freelist_init(struct pcpu_freelist *);
|
|
void pcpu_freelist_destroy(struct pcpu_freelist *s);
|
|
#endif
|