Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757366AbYCMXpv (ORCPT ); Thu, 13 Mar 2008 19:45:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752672AbYCMXpn (ORCPT ); Thu, 13 Mar 2008 19:45:43 -0400 Received: from rv-out-0910.google.com ([209.85.198.189]:58995 "EHLO rv-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752667AbYCMXpm (ORCPT ); Thu, 13 Mar 2008 19:45:42 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:mime-version:content-type; b=LCev+nJ6OIAP0sHBzDBvTr8wY9kGjVv1d1uKlo47sIbjjQOHLj77NS5GVgu5Yafhj9bfjnaV7UefXPvbvy2xeDfpW+tON3FZlCIm/ek9Hjmzb+RNmiMzkWoh1uMCKYsatXYlP/mRizr5PcAT6097CyfsZMjxO4vVQup9LAnHkTo= Message-ID: <86802c440803131645q1eb31cb7jb0774d9cf67c767@mail.gmail.com> Date: Thu, 13 Mar 2008 16:45:42 -0700 From: "Yinghai Lu" To: "Andrew Morton" , "Ingo Molnar" Subject: [PATCH] mm: make reserve_bootmem can crossed the nodes Cc: "Andi Kleen" , "Christoph Lameter" , linux-kernel@vger.kernel.org, "Yasunori Goto" , "KAMEZAWA Hiroyuki" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_13142_4822206.1205451942190" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5954 Lines: 88 ------=_Part_13142_4822206.1205451942190 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------=_Part_13142_4822206.1205451942190 Content-Type: text/x-patch; name=reserve_bootmem_cross_nodes.patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_fdryzh6o0 Content-Disposition: attachment; filename=reserve_bootmem_cross_nodes.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yk7CisJaWYgKHJl dCA8IDApCisJCXJldHVybjsKIAlyZXNlcnZlX2Jvb3RtZW1fY29yZShwZ2RhdC0+YmRhdGEsIHBo eXNhZGRyLCBzaXplLCBmbGFncyk7CiB9CiAKQEAgLTQzMiw3ICs0NjIsMTYgQEAgdW5zaWduZWQg bG9uZyBfX2luaXQgaW5pdF9ib290bWVtKHVuc2lnbgogaW50IF9faW5pdCByZXNlcnZlX2Jvb3Rt ZW0odW5zaWduZWQgbG9uZyBhZGRyLCB1bnNpZ25lZCBsb25nIHNpemUsCiAJCQkgICAgaW50IGZs YWdzKQogewotCXJldHVybiByZXNlcnZlX2Jvb3RtZW1fY29yZShOT0RFX0RBVEEoMCktPmJkYXRh LCBhZGRyLCBzaXplLCBmbGFncyk7CisJaW50IHJldDsKKwlib290bWVtX2RhdGFfdCAqYmRhdGE7 CisJbGlzdF9mb3JfZWFjaF9lbnRyeShiZGF0YSwgJmJkYXRhX2xpc3QsIGxpc3QpIHsKKwkJcmV0 ID0gY2FuX3Jlc2VydmVfYm9vdG1lbV9jb3JlKGJkYXRhLCBhZGRyLCBzaXplLCBmbGFncyk7CisJ CWlmIChyZXQgPCAwKQorCQkJcmV0dXJuIHJldDsKKwl9CisJbGlzdF9mb3JfZWFjaF9lbnRyeShi ZGF0YSwgJmJkYXRhX2xpc3QsIGxpc3QpCisJCXJlc2VydmVfYm9vdG1lbV9jb3JlKGJkYXRhLCBh ZGRyLCBzaXplLCBmbGFncyk7CisJcmV0dXJuIDA7CiB9CiAjZW5kaWYgLyogIUNPTkZJR19IQVZF X0FSQ0hfQk9PVE1FTV9OT0RFICovCiAK ------=_Part_13142_4822206.1205451942190-- -- 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/