Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754890AbYCQV1c (ORCPT ); Mon, 17 Mar 2008 17:27:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752727AbYCQV1Z (ORCPT ); Mon, 17 Mar 2008 17:27:25 -0400 Received: from wr-out-0506.google.com ([64.233.184.224]:39832 "EHLO wr-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752792AbYCQV1Y (ORCPT ); Mon, 17 Mar 2008 17:27:24 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Xq6SOHGmsXRhhiKPtCGsu2wAx4J7GB96/wQ5y25WV8ykCUMEM1VxIkInVjZStXHUaiUwUrg0NInSPv8l8htR+uhaqapFtXz6ALcOgonK7ueF1ruVf9icUFPyq+4Bqtuis6A/eDeLImGA0Ia1tYZ/RUXIe9Dizah6Gdv5uYkZ0wE= Message-ID: <86802c440803171427y7c9b2a54nacb0603916713033@mail.gmail.com> Date: Mon, 17 Mar 2008 14:27:21 -0700 From: "Yinghai Lu" To: "Andi Kleen" , "Andrew Morton" , "Ingo Molnar" , "Christoph Lameter" Subject: Re: [PATCH] [11/18] Fix alignment bug in bootmem allocator Cc: linux-kernel@vger.kernel.org, pj@sgi.com, linux-mm@kvack.org, nickpiggin@yahoo.com.au In-Reply-To: <86802c440803171152y379560dfp1296aefb0b86b54b@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_18705_33452704.1205789241136" References: <20080317258.659191058@firstfloor.org> <20080317015825.0C0171B41E0@basil.firstfloor.org> <86802c440803161919h20ed9f78k6e3798ef56668638@mail.gmail.com> <20080317070208.GC27015@one.firstfloor.org> <86802c440803170017r622114bdpede8625d1a8ff585@mail.gmail.com> <86802c440803170031u75167e5m301f65049b6d62ff@mail.gmail.com> <20080317074146.GG27015@one.firstfloor.org> <86802c440803170053n32a1c918h2ff2a32abef44050@mail.gmail.com> <20080317085604.GA12405@basil.nowhere.org> <86802c440803171152y379560dfp1296aefb0b86b54b@mail.gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8371 Lines: 135 ------=_Part_18705_33452704.1205789241136 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Mon, Mar 17, 2008 at 11:52 AM, Yinghai Lu wrote: > On Mon, Mar 17, 2008 at 1:56 AM, Andi Kleen wrote: > > > only happen when align is large than alignment of node_boot_start. > > > > Here's an updated version of the patch with this addressed. > > Please review. The patch is somewhat more complicated, but > > actually makes the code a little cleaner now. > > > > -Andi > > > > > > Fix alignment bug in bootmem allocator > > > > > > Without this fix bootmem can return unaligned addresses when the start of a > > node is not aligned to the align value. Needed for reliably allocating > > gigabyte pages. > > > > I removed the offset variable because all tests should align themself correctly > > now. Slight drawback might be that the bootmem allocator will spend > > some more time skipping bits in the bitmap initially, but that shouldn't > > be a big issue. > > > > > > Signed-off-by: Andi Kleen > > > how about create local node_boot_start and node_bootmem_map that make > sure node_boot_start has bigger alignment than align input. please check it YH ------=_Part_18705_33452704.1205789241136 Content-Type: text/x-patch; name=offset_alloc_bootmem_v2.patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_fdxjtwqk0 Content-Disposition: attachment; filename=offset_alloc_bootmem_v2.patch W1BBVENIXSBtbTogb2Zmc2V0IGFsaWduIGluIGFsbG9jX2Jvb3RtZW0gdjIKCm5lZWQgb2Zmc2V0 IGFsaWdubWVudCB3aGVuIG5vZGVfYm9vdF9zdGFydCdzIGFsaWdubWVudCBpcyBsZXNzIHRoYW4K YWxpZ24gcmVxdWlyZWQKCnYyOiB1c2UgbG9jYWwgbm9kZV9ib290X3N0YXJ0IHRvIG1hdGNoIGFs aWduLgoKU2lnbmVkLW9mZi1ieTogWWluZ2hhaSBMdSA8eWhsdS5rZXJuZ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zdGFydCk7CiAJCQliZGF0YS0+bGFzdF9wb3MgPSBzdGFydCArIGFyZWFzaXplIC0g MTsKIAkJCWJkYXRhLT5sYXN0X29mZnNldCA9IHJlbWFpbmluZ19zaXplOwogCQl9CkBAIC0zMTgs MTQgKzMyNSwxNCBAQCBmb3VuZDoKIAl9IGVsc2UgewogCQliZGF0YS0+bGFzdF9wb3MgPSBzdGFy dCArIGFyZWFzaXplIC0gMTsKIAkJYmRhdGEtPmxhc3Rfb2Zmc2V0ID0gc2l6ZSAmIH5QQUdFX01B U0s7Ci0JCXJldCA9IHBoeXNfdG9fdmlydChzdGFydCAqIFBBR0VfU0laRSArIGJkYXRhLT5ub2Rl X2Jvb3Rfc3RhcnQpOworCQlyZXQgPSBwaHlzX3RvX3ZpcnQoc3RhcnQgKiBQQUdFX1NJWkUgKyBu b2RlX2Jvb3Rfc3RhcnQpOwogCX0KIAogCS8qCiAJICogUmVzZXJ2ZSB0aGUgYXJlYSBub3c6CiAJ ICovCiAJZm9yIChpID0gc3RhcnQ7IGkgPCBzdGFydCArIGFyZWFzaXplOyBpKyspCi0JCWlmICh1 bmxpa2VseSh0ZXN0X2FuZF9zZXRfYml0KGksIGJkYXRhLT5ub2RlX2Jvb3RtZW1fbWFwKSkpCisJ CWlmICh1bmxpa2VseSh0ZXN0X2FuZF9zZXRfYml0KGksIG5vZGVfYm9vdG1lbV9tYXApKSkKIAkJ CUJVRygpOwogCW1lbXNldChyZXQsIDAsIHNpemUpOwogCXJldHVybiByZXQ7Cg== ------=_Part_18705_33452704.1205789241136-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/