linux/drivers/base/node.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Basic Node interface support
 */

#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 - Access class device to hold user visible
 * 			      relationships to other nodes.
 * @dev:	Device for this memory access class
 * @list_node:	List element in the node's access list
 * @access:	The access class rank
 * @coord:	Heterogeneous memory performance coordinates
 */
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[] =;

/**
 * node_set_perf_attrs - Set the performance values for given access class
 * @nid: Node identifier to be set
 * @coord: Heterogeneous memory performance coordinates
 * @access: The access class the for the given attributes
 */
void node_set_perf_attrs(unsigned int nid, struct access_coordinate *coord,
			 enum access_coordinate_class access)
{}
EXPORT_SYMBOL_GPL();

/**
 * struct node_cache_info - Internal tracking for memory node caches
 * @dev:	Device represeting the cache level
 * @node:	List element for tracking in the node
 * @cache_attrs:Attributes for this cache level
 */
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)
{}

/**
 * node_add_cache() - add cache attribute to a memory node
 * @nid: Node identifier that has new cache attributes
 * @cache_attrs: Attributes for the cache being added
 */
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)
{}

/*
 * register_node - Setup a sysfs device for a node.
 * @num - Node number to use when creating the device.
 *
 * Initialize and register the node device.
 */
static int register_node(struct node *node, int num)
{}

/**
 * unregister_node - unregister a node device
 * @node: node going away
 *
 * Unregisters a node device @node.  All the devices on the node must be
 * unregistered before calling this function.
 */
void unregister_node(struct node *node)
{}

struct node *node_devices[MAX_NUMNODES];

/*
 * register cpu under node
 */
int register_cpu_under_node(unsigned int cpu, unsigned int nid)
{}

/**
 * register_memory_node_under_compute_node - link memory node to its compute
 *					     node for a given access class.
 * @mem_nid:	Memory node number
 * @cpu_nid:	Cpu  node number
 * @access:	Access class to register
 *
 * Description:
 * 	For use with platforms that may have separate memory and compute nodes.
 * 	This function will export node relationships linking which memory
 * 	initiator nodes can access memory targets at a given ranked access
 * 	class.
 */
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)
{}

/* register memory section under specified node if it spans that node */
static int register_mem_block_under_node_early(struct memory_block *mem_blk,
					       void *arg)
{}

/*
 * During hotplug we know that all pages in the memory block belong to the same
 * node.
 */
static int register_mem_block_under_node_hotplug(struct memory_block *mem_blk,
						 void *arg)
{}

/*
 * Unregister a memory block device under the node it spans. Memory blocks
 * with multiple nodes cannot be offlined and therefore also never be removed.
 */
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 /* CONFIG_MEMORY_HOTPLUG */

int __register_one_node(int nid)
{}

void unregister_one_node(int nid)
{}

/*
 * node states attributes
 */

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)
{}