Skip to content
Snippets Groups Projects
Select Git revision
  • 6677e3eaf4d78abd7b09133414c05dc3ec353e7f
  • 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 18.04 KiB
    /*
     * Memory subsystem 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/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 <linux/atomic.h>
    #include <asm/uaccess.h>
    
    static DEFINE_MUTEX(mem_sysfs_mutex);
    
    #define MEMORY_CLASS_NAME	"memory"
    
    static int sections_per_block;
    
    static inline int base_memory_block_id(int section_nr)
    {
    	return section_nr / sections_per_block;
    }
    
    static struct bus_type memory_subsys = {
    	.name = MEMORY_CLASS_NAME,
    	.dev_name = MEMORY_CLASS_NAME,
    };
    
    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)
    {
    	return atomic_notifier_chain_register(&memory_isolate_chain, nb);
    }
    EXPORT_SYMBOL(register_memory_isolate_notifier);
    
    void unregister_memory_isolate_notifier(struct notifier_block *nb)
    {
    	atomic_notifier_chain_unregister(&memory_isolate_chain, nb);
    }