Skip to content
Snippets Groups Projects
Select Git revision
  • e4619c857d1d769b1172a75ba6b6ebd1186a9c58
  • master default protected
  • android-msm-bullhead-3.10-nougat_kgdb_less_changes
  • android-msm-bullhead-3.10-nougat_kgdb
  • android-msm-bullhead-3.10-nougat_klist
  • android-4.4
  • android-msm-vega-4.4-oreo-daydream
  • android-msm-wahoo-4.4-p-preview-5
  • android-msm-wahoo-4.4-pie
  • android-msm-marlin-3.18-p-preview-5
  • android-msm-marlin-3.18-pie
  • android-msm-wahoo-2018.07-oreo-m2
  • android-msm-wahoo-2018.07-oreo-m4
  • android-msm-wahoo-4.4-p-preview-4
  • android-msm-bullhead-3.10-oreo-m6
  • android-msm-angler-3.10-oreo-m6
  • android-msm-marlin-3.18-p-preview-4
  • android-msm-stargazer-3.18-oreo-wear-dr
  • android-msm-catshark-3.18-oreo-wear-dr
  • android-msm-wahoo-4.4-oreo-m2
  • android-msm-wahoo-4.4-oreo-m4
  • android-daydreamos-8.0.0_r0.5
  • android-8.1.0_r0.92
  • android-8.1.0_r0.91
  • android-daydreamos-8.0.0_r0.4
  • android-p-preview-5_r0.2
  • android-p-preview-5_r0.1
  • android-9.0.0_r0.5
  • android-9.0.0_r0.4
  • android-9.0.0_r0.2
  • android-9.0.0_r0.1
  • android-8.1.0_r0.81
  • android-8.1.0_r0.80
  • android-8.1.0_r0.78
  • android-8.1.0_r0.76
  • android-8.1.0_r0.75
  • android-8.1.0_r0.72
  • android-8.1.0_r0.70
  • android-p-preview-4_r0.2
  • android-p-preview-4_r0.1
  • android-wear-8.0.0_r0.30
41 results

memory.c

Blame
  • memory.c 14.06 KiB
    /*
     * drivers/base/memory.c - basic Memory class support
     *
     * Written by Matt Tolentino <matthew.e.tolentino@intel.com>
     *            Dave Hansen <haveblue@us.ibm.com>
     *
     * This file provides the necessary infrastructure to represent
     * a SPARSEMEM-memory-model system's physical memory in /sysfs.
     * All arch-independent code that assumes MEMORY_HOTPLUG requires
     * SPARSEMEM should be contained here, or in mm/memory_hotplug.c.
     */
    
    #include <linux/sysdev.h>
    #include <linux/module.h>
    #include <linux/init.h>
    #include <linux/topology.h>
    #include <linux/capability.h>
    #include <linux/device.h>
    #include <linux/memory.h>
    #include <linux/kobject.h>
    #include <linux/memory_hotplug.h>
    #include <linux/mm.h>
    #include <linux/mutex.h>
    #include <linux/stat.h>
    #include <linux/slab.h>
    
    #include <asm/atomic.h>
    #include <asm/uaccess.h>
    
    #define MEMORY_CLASS_NAME	"memory"
    
    static struct sysdev_class memory_sysdev_class = {
    	.name = MEMORY_CLASS_NAME,
    };
    
    static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
    {
    	return MEMORY_CLASS_NAME;
    }
    
    static int memory_uevent(struct kset *kset, struct kobject *obj, struct kobj_uevent_env *env)
    {
    	int retval = 0;
    
    	return retval;
    }
    
    static const struct kset_uevent_ops memory_uevent_ops = {
    	.name		= memory_uevent_name,
    	.uevent		= memory_uevent,
    };
    
    static BLOCKING_NOTIFIER_HEAD(memory_chain);
    
    int register_memory_notifier(struct notifier_block *nb)
    {
            return blocking_notifier_chain_register(&memory_chain, nb);
    }
    EXPORT_SYMBOL(register_memory_notifier);
    
    void unregister_memory_notifier(struct notifier_block *nb)
    {
            blocking_notifier_chain_unregister(&memory_chain, nb);
    }
    EXPORT_SYMBOL(unregister_memory_notifier);
    
    static ATOMIC_NOTIFIER_HEAD(memory_isolate_chain);
    
    int register_memory_isolate_notifier(struct notifier_block *nb)
    {