#include <linux/module.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/memory.h>
#include <linux/vmstat.h>
#include <linux/notifier.h>
#include <linux/node.h>
#include <linux/hugetlb.h>
#include <linux/compaction.h>
#include <linux/cpumask.h>
#include <linux/topology.h>
#include <linux/nodemask.h>
#include <linux/cpu.h>
#include <linux/device.h>
#include <linux/pm_runtime.h>
#include <linux/swap.h>
#include <linux/slab.h>
static const struct bus_type node_subsys = …;
static inline ssize_t cpumap_read(struct file *file, struct kobject *kobj,
struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
{ … }
static BIN_ATTR_RO(cpumap, CPUMAP_FILE_MAX_BYTES);
static inline ssize_t cpulist_read(struct file *file, struct kobject *kobj,
struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
{ … }
static BIN_ATTR_RO(cpulist, CPULIST_FILE_MAX_BYTES);
struct node_access_nodes { … };
#define to_access_nodes(dev) …
static struct attribute *node_init_access_node_attrs[] = …;
static struct attribute *node_targ_access_node_attrs[] = …;
static const struct attribute_group initiators = …;
static const struct attribute_group targets = …;
static const struct attribute_group *node_access_node_groups[] = …;
static void node_remove_accesses(struct node *node)
{ … }
static void node_access_release(struct device *dev)
{ … }
static struct node_access_nodes *node_init_node_access(struct node *node,
enum access_coordinate_class access)
{ … }
#ifdef CONFIG_HMEM_REPORTING
#define ACCESS_ATTR(property) …
ACCESS_ATTR(…);
ACCESS_ATTR(…);
ACCESS_ATTR(…);
ACCESS_ATTR(…);
static struct attribute *access_attrs[] = …;
void node_set_perf_attrs(unsigned int nid, struct access_coordinate *coord,
enum access_coordinate_class access)
{ … }
EXPORT_SYMBOL_GPL(…);
struct node_cache_info { … };
#define to_cache_info(device) …
#define CACHE_ATTR(name, fmt) …
CACHE_ATTR(…)
CACHE_ATTR(…)
CACHE_ATTR(…)
CACHE_ATTR(…)
static struct attribute *cache_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void node_cache_release(struct device *dev)
{ … }
static void node_cacheinfo_release(struct device *dev)
{ … }
static void node_init_cache_dev(struct node *node)
{ … }
void node_add_cache(unsigned int nid, struct node_cache_attrs *cache_attrs)
{ … }
static void node_remove_caches(struct node *node)
{ … }
static void node_init_caches(unsigned int nid)
{ … }
#else
static void node_init_caches(unsigned int nid) { }
static void node_remove_caches(struct node *node) { }
#endif
#define K …
static ssize_t node_read_meminfo(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
#undef K
static DEVICE_ATTR(meminfo, 0444, node_read_meminfo, NULL);
static ssize_t node_read_numastat(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(numastat, 0444, node_read_numastat, NULL);
static ssize_t node_read_vmstat(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(vmstat, 0444, node_read_vmstat, NULL);
static ssize_t node_read_distance(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(distance, 0444, node_read_distance, NULL);
static struct attribute *node_dev_attrs[] = …;
static struct bin_attribute *node_dev_bin_attrs[] = …;
static const struct attribute_group node_dev_group = …;
static const struct attribute_group *node_dev_groups[] = …;
static void node_device_release(struct device *dev)
{ … }
static int register_node(struct node *node, int num)
{ … }
void unregister_node(struct node *node)
{ … }
struct node *node_devices[MAX_NUMNODES];
int register_cpu_under_node(unsigned int cpu, unsigned int nid)
{ … }
int register_memory_node_under_compute_node(unsigned int mem_nid,
unsigned int cpu_nid,
enum access_coordinate_class access)
{ … }
int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
{ … }
#ifdef CONFIG_MEMORY_HOTPLUG
static int __ref get_nid_for_pfn(unsigned long pfn)
{ … }
static void do_register_memory_block_under_node(int nid,
struct memory_block *mem_blk,
enum meminit_context context)
{ … }
static int register_mem_block_under_node_early(struct memory_block *mem_blk,
void *arg)
{ … }
static int register_mem_block_under_node_hotplug(struct memory_block *mem_blk,
void *arg)
{ … }
void unregister_memory_block_under_nodes(struct memory_block *mem_blk)
{ … }
void register_memory_blocks_under_node(int nid, unsigned long start_pfn,
unsigned long end_pfn,
enum meminit_context context)
{ … }
#endif
int __register_one_node(int nid)
{ … }
void unregister_one_node(int nid)
{ … }
struct node_attr { … };
static ssize_t show_node_state(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
#define _NODE_ATTR(name, state) …
static struct node_attr node_state_attr[] = …;
static struct attribute *node_state_attrs[] = …;
static const struct attribute_group memory_root_attr_group = …;
static const struct attribute_group *cpu_root_attr_groups[] = …;
void __init node_dev_init(void)
{ … }