Exemplo n.º 1
0
int arch_remove_memory(u64 start, u64 size)
{
	unsigned long start_pfn = start >> PAGE_SHIFT;
	unsigned long nr_pages = size >> PAGE_SHIFT;
	struct zone *zone;
	int ret;

	zone = page_zone(pfn_to_page(start_pfn));
	ret = __remove_pages(zone, start_pfn, nr_pages);
	if (ret)
		return ret;

	/* Remove htab bolted mappings for this section of memory */
	start = (unsigned long)__va(start);
	ret = remove_section_mapping(start, start + size);

	/* Ensure all vmalloc mappings are flushed in case they also
	 * hit that section of memory
	 */
	vm_unmap_aliases();

	resize_hpt_for_hotplug(memblock_phys_mem_size());

	return ret;
}
Exemplo n.º 2
0
int __meminit arch_remove_memory(int nid, u64 start, u64 size,
					struct vmem_altmap *altmap)
{
	unsigned long start_pfn = start >> PAGE_SHIFT;
	unsigned long nr_pages = size >> PAGE_SHIFT;
	struct page *page;
	int ret;

	/*
	 * If we have an altmap then we need to skip over any reserved PFNs
	 * when querying the zone.
	 */
	page = pfn_to_page(start_pfn);
	if (altmap)
		page += vmem_altmap_offset(altmap);

	ret = __remove_pages(page_zone(page), start_pfn, nr_pages, altmap);
	if (ret)
		return ret;

	/* Remove htab bolted mappings for this section of memory */
	start = (unsigned long)__va(start);
	flush_inval_dcache_range(start, start + size);
	ret = remove_section_mapping(start, start + size);

	/* Ensure all vmalloc mappings are flushed in case they also
	 * hit that section of memory
	 */
	vm_unmap_aliases();

	resize_hpt_for_hotplug(memblock_phys_mem_size());

	return ret;
}
Exemplo n.º 3
0
Arquivo: mem.c Projeto: 03199618/linux
int arch_remove_memory(u64 start, u64 size)
{
	unsigned long start_pfn = start >> PAGE_SHIFT;
	unsigned long nr_pages = size >> PAGE_SHIFT;
	struct zone *zone;

	zone = page_zone(pfn_to_page(start_pfn));
	return __remove_pages(zone, start_pfn, nr_pages);
}
Exemplo n.º 4
0
/*
 * First pass at this code will check to determine if the remove
 * request is within the RMO.  Do not allow removal within the RMO.
 */
int __devinit remove_memory(u64 start, u64 size)
{
	struct zone *zone;
	unsigned long start_pfn, end_pfn, nr_pages;

	start_pfn = start >> PAGE_SHIFT;
	nr_pages = size >> PAGE_SHIFT;
	end_pfn = start_pfn + nr_pages;

	printk("%s(): Attempting to remove memoy in range "
			"%lx to %lx\n", __func__, start, start+size);
	/*
	 * check for range within RMO
	 */
	zone = page_zone(pfn_to_page(start_pfn));

	printk("%s(): memory will be removed from "
			"the %s zone\n", __func__, zone->name);

	/*
	 * not handling removing memory ranges that
	 * overlap multiple zones yet
	 */
	if (end_pfn > (zone->zone_start_pfn + zone->spanned_pages))
		goto overlap;

	/* make sure it is NOT in RMO */
	if ((start < lmb.rmo_size) || ((start+size) < lmb.rmo_size)) {
		printk("%s(): range to be removed must NOT be in RMO!\n",
			__func__);
		goto in_rmo;
	}

	return __remove_pages(zone, start_pfn, nr_pages);

overlap:
	printk("%s(): memory range to be removed overlaps "
		"multiple zones!!!\n", __func__);
in_rmo:
	return -1;
}