Linux Audio

Check our new training course

Loading...
v4.6
 
 1/* Copyright (c) 2016 Facebook
 2 *
 3 * This program is free software; you can redistribute it and/or
 4 * modify it under the terms of version 2 of the GNU General Public
 5 * License as published by the Free Software Foundation.
 6 */
 7#ifndef __PERCPU_FREELIST_H__
 8#define __PERCPU_FREELIST_H__
 9#include <linux/spinlock.h>
10#include <linux/percpu.h>
11
12struct pcpu_freelist_head {
13	struct pcpu_freelist_node *first;
14	raw_spinlock_t lock;
15};
16
17struct pcpu_freelist {
18	struct pcpu_freelist_head __percpu *freelist;
 
19};
20
21struct pcpu_freelist_node {
22	struct pcpu_freelist_node *next;
23};
24
 
25void pcpu_freelist_push(struct pcpu_freelist *, struct pcpu_freelist_node *);
26struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *);
 
 
 
27void pcpu_freelist_populate(struct pcpu_freelist *s, void *buf, u32 elem_size,
28			    u32 nr_elems);
29int pcpu_freelist_init(struct pcpu_freelist *);
30void pcpu_freelist_destroy(struct pcpu_freelist *s);
31#endif
v6.8
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/* Copyright (c) 2016 Facebook
 
 
 
 
 3 */
 4#ifndef __PERCPU_FREELIST_H__
 5#define __PERCPU_FREELIST_H__
 6#include <linux/spinlock.h>
 7#include <linux/percpu.h>
 8
 9struct pcpu_freelist_head {
10	struct pcpu_freelist_node *first;
11	raw_spinlock_t lock;
12};
13
14struct pcpu_freelist {
15	struct pcpu_freelist_head __percpu *freelist;
16	struct pcpu_freelist_head extralist;
17};
18
19struct pcpu_freelist_node {
20	struct pcpu_freelist_node *next;
21};
22
23/* pcpu_freelist_* do spin_lock_irqsave. */
24void pcpu_freelist_push(struct pcpu_freelist *, struct pcpu_freelist_node *);
25struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *);
26/* __pcpu_freelist_* do spin_lock only. caller must disable irqs. */
27void __pcpu_freelist_push(struct pcpu_freelist *, struct pcpu_freelist_node *);
28struct pcpu_freelist_node *__pcpu_freelist_pop(struct pcpu_freelist *);
29void pcpu_freelist_populate(struct pcpu_freelist *s, void *buf, u32 elem_size,
30			    u32 nr_elems);
31int pcpu_freelist_init(struct pcpu_freelist *);
32void pcpu_freelist_destroy(struct pcpu_freelist *s);
33#endif