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

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

Version: ~ [ linux-5.3-rc1 ] ~ [ linux-5.2.2 ] ~ [ linux-5.1.19 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.60 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.134 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.186 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.186 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.70 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp