lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 16 Aug 2011 20:14:31 +0800
From:	Rong Wang <wangrong8602@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: arm bootmem_init() - > find_limits() if CONFIG_HIGHMEM max_low will
 be 0

Hi,all

I'm recently study the linux memory management, and I'm confused by
this function: find_limits() in bootmem_init()

kernel: 2.6.38

void __init bootmem_init(void)          /* arm/mm/init.c */
{
	unsigned long min, max_low, max_high;

	max_low = max_high = 0;

	find_limits(&min, &max_low, &max_high);

------------------------------------------------------------------------------

static void __init find_limits(unsigned long *min, unsigned long
*max_low,                         /* arm/mm/init.c */
	unsigned long *max_high)
{
	struct meminfo *mi = &meminfo;
	int i;

	*min = -1UL;
	*max_low = *max_high = 0;

	for_each_bank (i, mi) {
		struct membank *bank = &mi->bank[i];
		unsigned long start, end;

		start = bank_pfn_start(bank);
		end = bank_pfn_end(bank);

		if (*min > start)
			*min = start;
		if (*max_high < end)
			*max_high = end;
		if (bank->highmem)
			continue;                                            /* Here, if we
CONFIG_HIGHMEM, and the highmem is set to be 1.

           * so max_low will be 0.

           */
		if (*max_low < end)
			*max_low = end;
	}
}

-------------------------------------------------------------------------------------

arm_bootmem_init(min, max_low);                            /* arm/mm/init.c */

-------------------------------------------------------------------------------------

static void __init arm_bootmem_init(unsigned long start_pfn,
	unsigned long end_pfn)
{
	struct memblock_region *reg;
	unsigned int boot_pages;
	phys_addr_t bitmap;
	pg_data_t *pgdat;

	/*
	 * Allocate the bootmem bitmap page.  This must be in a region
	 * of memory which has already been mapped.
	 */
	boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
     /* Here, because max_low is 0, and min is the minimum pfn the
board has(normally is not zero)

                                             * so the (end_pfn -
start_pfn) < 0

                                             */

My question is : I do not clearly see how the codes support HIGHMEM ?
and even more, how can the parameter passed to bootmem_bootmap_pages
is a negtive number?

This is my first question to the mail-list, thanks for your help.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ