* refs/heads/tmp-aab9adb Linux 4.4.179 kernel/sysctl.c: fix out-of-bounds access when setting file-max Revert "locking/lockdep: Add debug_locks check in __lock_downgrade()" ALSA: info: Fix racy addition/deletion of nodes mm/vmstat.c: fix /proc/vmstat format for CONFIG_DEBUG_TLBFLUSH=y CONFIG_SMP=n device_cgroup: fix RCU imbalance in error case sched/fair: Limit sched_cfs_period_timer() loop to avoid hard lockup Revert "kbuild: use -Oz instead of -Os when using clang" mac80211: do not call driver wake_tx_queue op during reconfig kprobes: Fix error check when reusing optimized probes kprobes: Mark ftrace mcount handler functions nokprobe x86/kprobes: Verify stack frame on kretprobe arm64: futex: Restore oldval initialization to work around buggy compilers crypto: x86/poly1305 - fix overflow during partial reduction ALSA: core: Fix card races between register and disconnect staging: comedi: ni_usb6501: Fix possible double-free of ->usb_rx_buf staging: comedi: ni_usb6501: Fix use of uninitialized mutex staging: comedi: vmk80xx: Fix possible double-free of ->usb_rx_buf staging: comedi: vmk80xx: Fix use of uninitialized semaphore io: accel: kxcjk1013: restore the range after resume. iio: adc: at91: disable adc channel interrupt in timeout case iio: ad_sigma_delta: select channel when reading register iio/gyro/bmg160: Use millidegrees for temperature scale KVM: x86: Don't clear EFER during SMM transitions for 32-bit vCPU tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete modpost: file2alias: check prototype of handler modpost: file2alias: go back to simple devtable lookup crypto: crypto4xx - properly set IV after de- and encrypt ipv4: ensure rcu_read_lock() in ipv4_link_failure() ipv4: recompile ip options in ipv4_link_failure tcp: tcp_grow_window() needs to respect tcp_space() net: fou: do not use guehdr after iptunnel_pull_offloads in gue_udp_recv net: bridge: multicast: use rcu to access port list from br_multicast_start_querier net: atm: Fix potential Spectre v1 vulnerabilities bonding: fix event handling for stacked bonds appletalk: Fix compile regression ovl: fix uid/gid when creating over whiteout tpm/tpm_crb: Avoid unaligned reads in crb_recv() include/linux/swap.h: use offsetof() instead of custom __swapoffset macro lib/div64.c: off by one in shift appletalk: Fix use-after-free in atalk_proc_exit ARM: 8839/1: kprobe: make patch_lock a raw_spinlock_t iommu/dmar: Fix buffer overflow during PCI bus notification crypto: sha512/arm - fix crash bug in Thumb2 build crypto: sha256/arm - fix crash bug in Thumb2 build cifs: fallback to older infolevels on findfirst queryinfo retry ACPI / SBS: Fix GPE storm on recent MacBookPro's ARM: samsung: Limit SAMSUNG_PM_CHECK config option to non-Exynos platforms serial: uartps: console_setup() can't be placed to init section f2fs: fix to do sanity check with current segment number 9p locks: add mount option for lock retry interval 9p: do not trust pdu content for stat item size rsi: improve kernel thread handling to fix kernel panic ext4: prohibit fstrim in norecovery mode fix incorrect error code mapping for OBJECTID_NOT_FOUND x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error iommu/vt-d: Check capability before disabling protected memory x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors x86/hpet: Prevent potential NULL pointer dereference perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test() perf tests: Fix a memory leak of cpu_map object in the openat_syscall_event_on_all_cpus test perf evsel: Free evsel->counts in perf_evsel__exit() perf top: Fix error handling in cmd_top() tools/power turbostat: return the exit status of a command thermal/int340x_thermal: fix mode setting thermal/int340x_thermal: Add additional UUIDs ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declaration mmc: davinci: remove extraneous __init annotation IB/mlx4: Fix race condition between catas error reset and aliasguid flows ALSA: sb8: add a check for request_region ALSA: echoaudio: add a check for ioremap_nocache ext4: report real fs size after failed resize ext4: add missing brelse() in add_new_gdb_meta_bg() perf/core: Restore mmap record type correctly PCI: Add function 1 DMA alias quirk for Marvell 9170 SATA controller xtensa: fix return_address sched/fair: Do not re-read ->h_load_next during hierarchical load calculation xen: Prevent buffer overflow in privcmd ioctl arm64: futex: Fix FUTEX_WAKE_OP atomic ops with non-zero result value ARM: dts: at91: Fix typo in ISC_D0 on PC9 genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent() block: do not leak memory in bio_copy_user_iov() ASoC: fsl_esai: fix channel swap issue when stream starts include/linux/bitrev.h: fix constant bitrev ALSA: seq: Fix OOB-reads from strlcpy ip6_tunnel: Match to ARPHRD_TUNNEL6 for dev type net: ethtool: not call vzalloc for zero sized memory request netns: provide pure entropy for net_hash_mix() tcp: Ensure DCTCP reacts to losses sctp: initialize _pad of sockaddr_in before copying to user memory qmi_wwan: add Olicard 600 openvswitch: fix flow actions reallocation net: rds: force to destroy connection if t_sock is NULL in rds_tcp_kill_sock(). ipv6: sit: reset ip header pointer in ipip6_rcv ipv6: Fix dangling pointer when ipv6 fragment tty: ldisc: add sysctl to prevent autoloading of ldiscs tty: mark Siemens R3964 line discipline as BROKEN lib/string.c: implement a basic bcmp x86/vdso: Drop implicit common-page-size linker flag x86: vdso: Use $LD instead of $CC to link x86/build: Specify elf_i386 linker emulation explicitly for i386 objects kbuild: clang: choose GCC_TOOLCHAIN_DIR not on LD binfmt_elf: switch to new creds when switching to new mm drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers dmaengine: tegra: avoid overflow of byte tracking x86/build: Mark per-CPU symbols as absolute explicitly for LLD wlcore: Fix memory leak in case wl12xx_fetch_firmware failure regulator: act8865: Fix act8600_sudcdc_voltage_ranges setting media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration netfilter: physdev: relax br_netfilter dependency dmaengine: imx-dma: fix warning comparison of distinct pointer types hpet: Fix missing '=' character in the __setup() code of hpet_mmap_enable soc/tegra: fuse: Fix illegal free of IO base address hwrng: virtio - Avoid repeated init of completion media: mt9m111: set initial frame size other than 0x0 tty: increase the default flip buffer limit to 2*640K ARM: avoid Cortex-A9 livelock on tight dmb loops mt7601u: bump supported EEPROM version soc: qcom: gsbi: Fix error handling in gsbi_probe() ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe cdrom: Fix race condition in cdrom_sysctl_register fbdev: fbmem: fix memory access if logo is bigger than the screen bcache: improve sysfs_strtoul_clamp() bcache: fix input overflow to sequential_cutoff bcache: fix input overflow to cache set sysfs file io_error_halflife ALSA: PCM: check if ops are defined before suspending PCM ARM: 8833/1: Ensure that NEON code always compiles with Clang kprobes: Prohibit probing on bsearch() leds: lp55xx: fix null deref on firmware load failure media: mx2_emmaprp: Correct return type for mem2mem buffer helpers media: s5p-g2d: Correct return type for mem2mem buffer helpers media: s5p-jpeg: Correct return type for mem2mem buffer helpers media: sh_veu: Correct return type for mem2mem buffer helpers SoC: imx-sgtl5000: add missing put_device() perf test: Fix failure of 'evsel-tp-sched' test on s390 scsi: megaraid_sas: return error when create DMA pool failed IB/mlx4: Increase the timeout for CM cache e1000e: Fix -Wformat-truncation warnings mmc: omap: fix the maximum timeout setting ARM: 8840/1: use a raw_spinlock_t in unwind coresight: etm4x: Add support to enable ETMv4.2 scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c usb: chipidea: Grab the (legacy) USB PHY by phandle first tools lib traceevent: Fix buffer overflow in arg_eval fs: fix guard_bio_eod to check for real EOD errors cifs: Fix NULL pointer dereference of devname dm thin: add sanity checks to thin-pool and external snapshot creation cifs: use correct format characters fs/file.c: initialize init_files.resize_wait f2fs: do not use mutex lock in atomic context ocfs2: fix a panic problem caused by o2cb_ctl mm/slab.c: kmemleak no scan alien caches mm/vmalloc.c: fix kernel BUG at mm/vmalloc.c:512! mm/page_ext.c: fix an imbalance with kmemleak mm/cma.c: cma_declare_contiguous: correct err handling enic: fix build warning without CONFIG_CPUMASK_OFFSTACK sysctl: handle overflow for file-max gpio: gpio-omap: fix level interrupt idling tracing: kdb: Fix ftdump to not sleep h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux- CIFS: fix POSIX lock leak and invalid ptr deref tty/serial: atmel: RS485 HD w/DMA: enable RX after TX is stopped Bluetooth: Fix decrementing reference count twice in releasing socket i2c: core-smbus: prevent stack corruption on read I2C_BLOCK_DATA mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified tty/serial: atmel: Add is_half_duplex helper lib/int_sqrt: optimize initial value compute ext4: cleanup bh release code in ext4_ind_remove_space() arm64: debug: Ensure debug handlers check triggering exception level arm64: debug: Don't propagate UNKNOWN FAR into si_code for debug signals Make arm64 serial port config compatible with crosvm Fix merge issue with 4.4.178 Fix merge issue with 4.4.177 ANDROID: cuttlefish_defconfig: Enable CONFIG_OVERLAY_FS Change-Id: I0d6e7b00f0198867803d5fe305ce13e205cc7518 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
407 lines
10 KiB
C
407 lines
10 KiB
C
#include <linux/mm.h>
|
|
#include <linux/mmzone.h>
|
|
#include <linux/bootmem.h>
|
|
#include <linux/page_ext.h>
|
|
#include <linux/memory.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <linux/kmemleak.h>
|
|
#include <linux/page_owner.h>
|
|
#include <linux/page_idle.h>
|
|
|
|
/*
|
|
* struct page extension
|
|
*
|
|
* This is the feature to manage memory for extended data per page.
|
|
*
|
|
* Until now, we must modify struct page itself to store extra data per page.
|
|
* This requires rebuilding the kernel and it is really time consuming process.
|
|
* And, sometimes, rebuild is impossible due to third party module dependency.
|
|
* At last, enlarging struct page could cause un-wanted system behaviour change.
|
|
*
|
|
* This feature is intended to overcome above mentioned problems. This feature
|
|
* allocates memory for extended data per page in certain place rather than
|
|
* the struct page itself. This memory can be accessed by the accessor
|
|
* functions provided by this code. During the boot process, it checks whether
|
|
* allocation of huge chunk of memory is needed or not. If not, it avoids
|
|
* allocating memory at all. With this advantage, we can include this feature
|
|
* into the kernel in default and can avoid rebuild and solve related problems.
|
|
*
|
|
* To help these things to work well, there are two callbacks for clients. One
|
|
* is the need callback which is mandatory if user wants to avoid useless
|
|
* memory allocation at boot-time. The other is optional, init callback, which
|
|
* is used to do proper initialization after memory is allocated.
|
|
*
|
|
* The need callback is used to decide whether extended memory allocation is
|
|
* needed or not. Sometimes users want to deactivate some features in this
|
|
* boot and extra memory would be unneccessary. In this case, to avoid
|
|
* allocating huge chunk of memory, each clients represent their need of
|
|
* extra memory through the need callback. If one of the need callbacks
|
|
* returns true, it means that someone needs extra memory so that
|
|
* page extension core should allocates memory for page extension. If
|
|
* none of need callbacks return true, memory isn't needed at all in this boot
|
|
* and page extension core can skip to allocate memory. As result,
|
|
* none of memory is wasted.
|
|
*
|
|
* The init callback is used to do proper initialization after page extension
|
|
* is completely initialized. In sparse memory system, extra memory is
|
|
* allocated some time later than memmap is allocated. In other words, lifetime
|
|
* of memory for page extension isn't same with memmap for struct page.
|
|
* Therefore, clients can't store extra data until page extension is
|
|
* initialized, even if pages are allocated and used freely. This could
|
|
* cause inadequate state of extra data per page, so, to prevent it, client
|
|
* can utilize this callback to initialize the state of it correctly.
|
|
*/
|
|
|
|
static struct page_ext_operations *page_ext_ops[] = {
|
|
&debug_guardpage_ops,
|
|
#ifdef CONFIG_PAGE_OWNER
|
|
&page_owner_ops,
|
|
#endif
|
|
#if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
|
|
&page_idle_ops,
|
|
#endif
|
|
};
|
|
|
|
static unsigned long total_usage;
|
|
|
|
static bool __init invoke_need_callbacks(void)
|
|
{
|
|
int i;
|
|
int entries = ARRAY_SIZE(page_ext_ops);
|
|
|
|
for (i = 0; i < entries; i++) {
|
|
if (page_ext_ops[i]->need && page_ext_ops[i]->need())
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
static void __init invoke_init_callbacks(void)
|
|
{
|
|
int i;
|
|
int entries = ARRAY_SIZE(page_ext_ops);
|
|
|
|
for (i = 0; i < entries; i++) {
|
|
if (page_ext_ops[i]->init)
|
|
page_ext_ops[i]->init();
|
|
}
|
|
}
|
|
|
|
#if !defined(CONFIG_SPARSEMEM)
|
|
|
|
|
|
void __meminit pgdat_page_ext_init(struct pglist_data *pgdat)
|
|
{
|
|
pgdat->node_page_ext = NULL;
|
|
}
|
|
|
|
struct page_ext *lookup_page_ext(struct page *page)
|
|
{
|
|
unsigned long pfn = page_to_pfn(page);
|
|
unsigned long offset;
|
|
struct page_ext *base;
|
|
|
|
base = NODE_DATA(page_to_nid(page))->node_page_ext;
|
|
/*
|
|
* The sanity checks the page allocator does upon freeing a
|
|
* page can reach here before the page_ext arrays are
|
|
* allocated when feeding a range of pages to the allocator
|
|
* for the first time during bootup or memory hotplug.
|
|
*
|
|
* This check is also necessary for ensuring page poisoning
|
|
* works as expected when enabled
|
|
*/
|
|
if (unlikely(!base))
|
|
return NULL;
|
|
offset = pfn - round_down(node_start_pfn(page_to_nid(page)),
|
|
MAX_ORDER_NR_PAGES);
|
|
return base + offset;
|
|
}
|
|
|
|
static int __init alloc_node_page_ext(int nid)
|
|
{
|
|
struct page_ext *base;
|
|
unsigned long table_size;
|
|
unsigned long nr_pages;
|
|
|
|
nr_pages = NODE_DATA(nid)->node_spanned_pages;
|
|
if (!nr_pages)
|
|
return 0;
|
|
|
|
/*
|
|
* Need extra space if node range is not aligned with
|
|
* MAX_ORDER_NR_PAGES. When page allocator's buddy algorithm
|
|
* checks buddy's status, range could be out of exact node range.
|
|
*/
|
|
if (!IS_ALIGNED(node_start_pfn(nid), MAX_ORDER_NR_PAGES) ||
|
|
!IS_ALIGNED(node_end_pfn(nid), MAX_ORDER_NR_PAGES))
|
|
nr_pages += MAX_ORDER_NR_PAGES;
|
|
|
|
table_size = sizeof(struct page_ext) * nr_pages;
|
|
|
|
base = memblock_virt_alloc_try_nid_nopanic(
|
|
table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS),
|
|
BOOTMEM_ALLOC_ACCESSIBLE, nid);
|
|
if (!base)
|
|
return -ENOMEM;
|
|
NODE_DATA(nid)->node_page_ext = base;
|
|
total_usage += table_size;
|
|
return 0;
|
|
}
|
|
|
|
void __init page_ext_init_flatmem(void)
|
|
{
|
|
|
|
int nid, fail;
|
|
|
|
if (!invoke_need_callbacks())
|
|
return;
|
|
|
|
for_each_online_node(nid) {
|
|
fail = alloc_node_page_ext(nid);
|
|
if (fail)
|
|
goto fail;
|
|
}
|
|
pr_info("allocated %ld bytes of page_ext\n", total_usage);
|
|
invoke_init_callbacks();
|
|
return;
|
|
|
|
fail:
|
|
pr_crit("allocation of page_ext failed.\n");
|
|
panic("Out of memory");
|
|
}
|
|
|
|
#else /* CONFIG_FLAT_NODE_MEM_MAP */
|
|
|
|
struct page_ext *lookup_page_ext(struct page *page)
|
|
{
|
|
unsigned long pfn = page_to_pfn(page);
|
|
struct mem_section *section = __pfn_to_section(pfn);
|
|
/*
|
|
* The sanity checks the page allocator does upon freeing a
|
|
* page can reach here before the page_ext arrays are
|
|
* allocated when feeding a range of pages to the allocator
|
|
* for the first time during bootup or memory hotplug.
|
|
*
|
|
* This check is also necessary for ensuring page poisoning
|
|
* works as expected when enabled
|
|
*/
|
|
if (!section || !section->page_ext)
|
|
return NULL;
|
|
return section->page_ext + pfn;
|
|
}
|
|
|
|
static void *__meminit alloc_page_ext(size_t size, int nid)
|
|
{
|
|
gfp_t flags = GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN;
|
|
void *addr = NULL;
|
|
|
|
addr = alloc_pages_exact_nid(nid, size, flags);
|
|
if (addr) {
|
|
kmemleak_alloc(addr, size, 1, flags);
|
|
return addr;
|
|
}
|
|
|
|
if (node_state(nid, N_HIGH_MEMORY))
|
|
addr = vzalloc_node(size, nid);
|
|
else
|
|
addr = vzalloc(size);
|
|
|
|
return addr;
|
|
}
|
|
|
|
static int __meminit init_section_page_ext(unsigned long pfn, int nid)
|
|
{
|
|
struct mem_section *section;
|
|
struct page_ext *base;
|
|
unsigned long table_size;
|
|
|
|
section = __pfn_to_section(pfn);
|
|
|
|
if (section->page_ext)
|
|
return 0;
|
|
|
|
table_size = sizeof(struct page_ext) * PAGES_PER_SECTION;
|
|
base = alloc_page_ext(table_size, nid);
|
|
|
|
/*
|
|
* The value stored in section->page_ext is (base - pfn)
|
|
* and it does not point to the memory block allocated above,
|
|
* causing kmemleak false positives.
|
|
*/
|
|
kmemleak_not_leak(base);
|
|
|
|
if (!base) {
|
|
pr_err("page ext allocation failure\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
/*
|
|
* The passed "pfn" may not be aligned to SECTION. For the calculation
|
|
* we need to apply a mask.
|
|
*/
|
|
pfn &= PAGE_SECTION_MASK;
|
|
section->page_ext = base - pfn;
|
|
total_usage += table_size;
|
|
return 0;
|
|
}
|
|
#ifdef CONFIG_MEMORY_HOTPLUG
|
|
static void free_page_ext(void *addr)
|
|
{
|
|
if (is_vmalloc_addr(addr)) {
|
|
vfree(addr);
|
|
} else {
|
|
struct page *page = virt_to_page(addr);
|
|
size_t table_size;
|
|
|
|
table_size = sizeof(struct page_ext) * PAGES_PER_SECTION;
|
|
|
|
BUG_ON(PageReserved(page));
|
|
kmemleak_free(addr);
|
|
free_pages_exact(addr, table_size);
|
|
}
|
|
}
|
|
|
|
static void __free_page_ext(unsigned long pfn)
|
|
{
|
|
struct mem_section *ms;
|
|
struct page_ext *base;
|
|
|
|
ms = __pfn_to_section(pfn);
|
|
if (!ms || !ms->page_ext)
|
|
return;
|
|
base = ms->page_ext + pfn;
|
|
free_page_ext(base);
|
|
ms->page_ext = NULL;
|
|
}
|
|
|
|
static int __meminit online_page_ext(unsigned long start_pfn,
|
|
unsigned long nr_pages,
|
|
int nid)
|
|
{
|
|
unsigned long start, end, pfn;
|
|
int fail = 0;
|
|
|
|
start = SECTION_ALIGN_DOWN(start_pfn);
|
|
end = SECTION_ALIGN_UP(start_pfn + nr_pages);
|
|
|
|
if (nid == -1) {
|
|
/*
|
|
* In this case, "nid" already exists and contains valid memory.
|
|
* "start_pfn" passed to us is a pfn which is an arg for
|
|
* online__pages(), and start_pfn should exist.
|
|
*/
|
|
nid = pfn_to_nid(start_pfn);
|
|
VM_BUG_ON(!node_state(nid, N_ONLINE));
|
|
}
|
|
|
|
for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) {
|
|
if (!pfn_present(pfn))
|
|
continue;
|
|
fail = init_section_page_ext(pfn, nid);
|
|
}
|
|
if (!fail)
|
|
return 0;
|
|
|
|
/* rollback */
|
|
for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION)
|
|
__free_page_ext(pfn);
|
|
|
|
return -ENOMEM;
|
|
}
|
|
|
|
static int __meminit offline_page_ext(unsigned long start_pfn,
|
|
unsigned long nr_pages, int nid)
|
|
{
|
|
unsigned long start, end, pfn;
|
|
|
|
start = SECTION_ALIGN_DOWN(start_pfn);
|
|
end = SECTION_ALIGN_UP(start_pfn + nr_pages);
|
|
|
|
for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION)
|
|
__free_page_ext(pfn);
|
|
return 0;
|
|
|
|
}
|
|
|
|
static int __meminit page_ext_callback(struct notifier_block *self,
|
|
unsigned long action, void *arg)
|
|
{
|
|
struct memory_notify *mn = arg;
|
|
int ret = 0;
|
|
|
|
switch (action) {
|
|
case MEM_GOING_ONLINE:
|
|
ret = online_page_ext(mn->start_pfn,
|
|
mn->nr_pages, mn->status_change_nid);
|
|
break;
|
|
case MEM_OFFLINE:
|
|
offline_page_ext(mn->start_pfn,
|
|
mn->nr_pages, mn->status_change_nid);
|
|
break;
|
|
case MEM_CANCEL_ONLINE:
|
|
offline_page_ext(mn->start_pfn,
|
|
mn->nr_pages, mn->status_change_nid);
|
|
break;
|
|
case MEM_GOING_OFFLINE:
|
|
break;
|
|
case MEM_ONLINE:
|
|
case MEM_CANCEL_OFFLINE:
|
|
break;
|
|
}
|
|
|
|
return notifier_from_errno(ret);
|
|
}
|
|
|
|
#endif
|
|
|
|
void __init page_ext_init(void)
|
|
{
|
|
unsigned long pfn;
|
|
int nid;
|
|
|
|
if (!invoke_need_callbacks())
|
|
return;
|
|
|
|
for_each_node_state(nid, N_MEMORY) {
|
|
unsigned long start_pfn, end_pfn;
|
|
|
|
start_pfn = node_start_pfn(nid);
|
|
end_pfn = node_end_pfn(nid);
|
|
/*
|
|
* start_pfn and end_pfn may not be aligned to SECTION and the
|
|
* page->flags of out of node pages are not initialized. So we
|
|
* scan [start_pfn, the biggest section's pfn < end_pfn) here.
|
|
*/
|
|
for (pfn = start_pfn; pfn < end_pfn;
|
|
pfn = ALIGN(pfn + 1, PAGES_PER_SECTION)) {
|
|
|
|
if (!pfn_valid(pfn))
|
|
continue;
|
|
/*
|
|
* Nodes's pfns can be overlapping.
|
|
* We know some arch can have a nodes layout such as
|
|
* -------------pfn-------------->
|
|
* N0 | N1 | N2 | N0 | N1 | N2|....
|
|
*/
|
|
if (pfn_to_nid(pfn) != nid)
|
|
continue;
|
|
if (init_section_page_ext(pfn, nid))
|
|
goto oom;
|
|
}
|
|
}
|
|
hotplug_memory_notifier(page_ext_callback, 0);
|
|
pr_info("allocated %ld bytes of page_ext\n", total_usage);
|
|
invoke_init_callbacks();
|
|
return;
|
|
|
|
oom:
|
|
panic("Out of memory");
|
|
}
|
|
|
|
void __meminit pgdat_page_ext_init(struct pglist_data *pgdat)
|
|
{
|
|
}
|
|
|
|
#endif
|