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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87d4ori5e6.fsf@saeurebad.de>
Date:	Tue, 15 Apr 2008 16:01:21 +0200
From:	Johannes Weiner <hannes@...urebad.de>
To:	Roel Kluin <12o3l@...cali.nl>
Cc:	Ingo Molnar <mingo@...e.hu>, akpm@...ux-foundation.org,
	mm-commits@...r.kernel.org, ak@...e.de, clameter@....com,
	kamezawa.hiroyu@...fujitsu.com, y-goto@...fujitsu.com,
	yhlu.kernel@...il.com, linux-kernel@...r.kernel.org
Subject: Re: + bootmem-node-setup-agnostic-free_bootmem.patch added to -mm tree

Hi,

Roel Kluin <12o3l@...cali.nl> writes:

> Johannes Weiner wrote:
>
>> How about the following (untested, even uncompiled, but you should get
>> the idea) proposal which would replace the patch discussed in this
>> thread:
>> 
>> --- tree-linus.orig/mm/bootmem.c
>> +++ tree-linus/mm/bootmem.c
>> @@ -421,7 +421,25 @@ int __init reserve_bootmem(unsigned long
>>  
>>  void __init free_bootmem(unsigned long addr, unsigned long size)
>>  {
>> -	free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
>> +	bootmem_data_t *bdata;
>> +
>> +	list_for_each_entry(bdata, &bdata_list, list) {
>> +		unsigned long remainder = 0;
>> +
>> +		if (addr < bdata->node_boot_start)
>> +			continue;
>> +
>> +		if (PFN_DOWN(addr + size) > bdata->node_low_pfn)
>> +			remainder = PFN_DOWN(addr + size) - bdata->node_low_pfn;
>> +
>> +		size -= PFN_PHYS(remainder);
>> +		free_bootmem_core(bdata, addr, size)
> Missing semicolon here -----------------------------^

Yes.  Intentional compiler trap for untested code *cough*

>> +
>> +		if (!remainder)
>> +			break;
>> +
>> +		addr = PFN_PHYS(bdata->node_low_pfn + 1);
>> +	}
>>  }
>
> This should do the same as (untested):
>
> void __init free_bootmem(unsigned long addr, unsigned long size)
> {
> 	bootmem_data_t *bdata;
>
> 	list_for_each_entry(bdata, &bdata_list, list) {
> 		unsigned long remainder;
                ^^^^^^^^
>
> 		if (addr < bdata->node_boot_start)
> 			continue;
>
> 		remainder = PFN_DOWN(addr + size) - bdata->node_low_pfn;
>
> 		if (remainder <= 0) {

Boom.

> 			free_bootmem_core(bdata, addr, size);
> 			return;
> 		}
>
> 		size -= PFN_PHYS(remainder);
> 		free_bootmem_core(bdata, addr, size);
> 		addr = PFN_PHYS(bdata->node_low_pfn + 1);
> 	}
> }

	Hannes
--
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