~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/cpu_rmap.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 #ifndef __LINUX_CPU_RMAP_H
  3 #define __LINUX_CPU_RMAP_H
  4 
  5 /*
  6  * cpu_rmap.c: CPU affinity reverse-map support
  7  * Copyright 2011 Solarflare Communications Inc.
  8  */
  9 
 10 #include <linux/cpumask_types.h>
 11 #include <linux/gfp.h>
 12 #include <linux/slab.h>
 13 #include <linux/kref.h>
 14 
 15 /**
 16  * struct cpu_rmap - CPU affinity reverse-map
 17  * @refcount: kref for object
 18  * @size: Number of objects to be reverse-mapped
 19  * @obj: Pointer to array of object pointers
 20  * @near: For each CPU, the index and distance to the nearest object,
 21  *      based on affinity masks
 22  */
 23 struct cpu_rmap {
 24         struct kref     refcount;
 25         u16             size;
 26         void            **obj;
 27         struct {
 28                 u16     index;
 29                 u16     dist;
 30         }               near[];
 31 };
 32 #define CPU_RMAP_DIST_INF 0xffff
 33 
 34 extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags);
 35 extern int cpu_rmap_put(struct cpu_rmap *rmap);
 36 
 37 extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj);
 38 extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index,
 39                            const struct cpumask *affinity);
 40 
 41 static inline u16 cpu_rmap_lookup_index(struct cpu_rmap *rmap, unsigned int cpu)
 42 {
 43         return rmap->near[cpu].index;
 44 }
 45 
 46 static inline void *cpu_rmap_lookup_obj(struct cpu_rmap *rmap, unsigned int cpu)
 47 {
 48         return rmap->obj[rmap->near[cpu].index];
 49 }
 50 
 51 /**
 52  * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs
 53  * @size: Number of objects to be mapped
 54  *
 55  * Must be called in process context.
 56  */
 57 static inline struct cpu_rmap *alloc_irq_cpu_rmap(unsigned int size)
 58 {
 59         return alloc_cpu_rmap(size, GFP_KERNEL);
 60 }
 61 extern void free_irq_cpu_rmap(struct cpu_rmap *rmap);
 62 
 63 int irq_cpu_rmap_remove(struct cpu_rmap *rmap, int irq);
 64 extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq);
 65 
 66 #endif /* __LINUX_CPU_RMAP_H */
 67 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php