From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sj-core-2.cisco.com (sj-core-2.cisco.com [171.71.177.254]) by sj-dkim-3.cisco.com (8.12.11/8.12.11) with ESMTP id m6TIBlZA000543 for ; Tue, 29 Jul 2008 11:11:47 -0700 Received: from sausatlsmtp2.sciatl.com ([192.133.217.159]) by sj-core-2.cisco.com (8.13.8/8.13.8) with ESMTP id m6TIBkRc007317 for ; Tue, 29 Jul 2008 18:11:46 GMT Message-ID: <488F5D5F.9010006@sciatl.com> Date: Tue, 29 Jul 2008 11:11:43 -0700 From: C Michael Sundius MIME-Version: 1.0 Subject: sparcemem or discontig? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: linux-mm@kvack.org Cc: msundius@sundius.com List-ID: Hi, I'm working on a 32bit mips 1 cpu platform that has 2 large banks of memory that are discontiguous in the physical address space. That is to say there is a large hole in between them. We are using the 2.6.24 kernel. In order to save memory on page tables, we'd like to employ the use of either the CONFIG_SPARCEMEM, or CONFIG_DISCONTIG configuration options, but I'm a bit unsure which I should use. My understanding is that SPARCEMEM is the way of the future, and since I don't really have a NUMA machine, maybe sparcemem is more appropriate, yes? On the other hand I can't find much info about how it works or how to add support for it on an architecture that has here-to-fore not supported that option. Is there anywhere that there is a paper or rfp that describes how the spacemem (or discontig) features work (and/or the differences between then)? Has anyone out there done this for MIPS32? has anyone had experience with adding support for either sparcemem or discontig on an arch before , that could give me a their thoughts the process or "gotchas"? thanks Mike - - - - - Cisco - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e32.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m6TLjNmv007627 for ; Tue, 29 Jul 2008 17:45:23 -0400 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m6TLpNW9123312 for ; Tue, 29 Jul 2008 15:51:23 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m6TLpNxo024383 for ; Tue, 29 Jul 2008 15:51:23 -0600 Subject: Re: sparcemem or discontig? From: Dave Hansen In-Reply-To: <488F5D5F.9010006@sciatl.com> References: <488F5D5F.9010006@sciatl.com> Content-Type: text/plain Date: Tue, 29 Jul 2008 14:51:21 -0700 Message-Id: <1217368281.13228.72.camel@nimitz> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: C Michael Sundius Cc: linux-mm@kvack.org, msundius@sundius.com, Andy Whitcroft List-ID: On Tue, 2008-07-29 at 11:11 -0700, C Michael Sundius wrote: > > My understanding is that SPARCEMEM is the way of the future, and since > I don't really have a NUMA machine, maybe sparcemem is more appropriate, > yes? On the other hand I can't find much info about how it works or how > to add support for it on an architecture that has here-to-fore not > supported that option. > > Is there anywhere that there is a paper or rfp that describes how the > spacemem (or discontig) features work (and/or the differences between > then)? I think you're talking about sparsemem. :) My opinion is that NUMA and DISCONTIG are too intertwined to be useful apart from the other. I use sparsemem on my non-NUMA 2 CPU laptop since it has a 1GB hole. It is *possible* to use DISCONTIG without NUMA, and I'm sure people use it this way, but I just personally think it is a bit of a pain. Basically, to add sparsemem support for an architecture, you need a header like these: dave@nimitz:~/lse/linux/2.5/linux-2.6.git$ find | grep sparse | xargs grep -c '^.*$' ./include/asm-powerpc/sparsemem.h:32 ./include/asm-x86/sparsemem.h:34 ./include/asm-sh/sparsemem.h:16 ./include/asm-mips/sparsemem.h:14 ./include/asm-ia64/sparsemem.h:20 ./include/asm-s390/sparsemem.h:18 ./include/asm-arm/sparsemem.h:10 These are generally pretty darn small (the largest is 34 lines). You also need to tweak some things in your per-arch Kconfig. ARM looks like a pretty simple use of sparsemem. You might want to start with what they've done. We tried really, really hard to make it easy to add to new architectures. Feel free to cc me and Andy (cc'd) on the patches that you come up with. I'd be happy to sanity check them for you. If *you* want to document the process for the next guy, I'm sure we'd be able to find some spot in Documentation/ so the next guy has an easier time. :) -- Dave -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 30 Jul 2008 10:35:52 +0100 From: Andy Whitcroft Subject: Re: sparcemem or discontig? Message-ID: <20080730093552.GD1369@brain> References: <488F5D5F.9010006@sciatl.com> <1217368281.13228.72.camel@nimitz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1217368281.13228.72.camel@nimitz> Sender: owner-linux-mm@kvack.org Return-Path: To: Dave Hansen Cc: C Michael Sundius , linux-mm@kvack.org, msundius@sundius.com List-ID: On Tue, Jul 29, 2008 at 02:51:21PM -0700, Dave Hansen wrote: > On Tue, 2008-07-29 at 11:11 -0700, C Michael Sundius wrote: > > > > My understanding is that SPARCEMEM is the way of the future, and since > > I don't really have a NUMA machine, maybe sparcemem is more appropriate, > > yes? On the other hand I can't find much info about how it works or how > > to add support for it on an architecture that has here-to-fore not > > supported that option. > > > > Is there anywhere that there is a paper or rfp that describes how the > > spacemem (or discontig) features work (and/or the differences between > > then)? > > I think you're talking about sparsemem. :) > > My opinion is that NUMA and DISCONTIG are too intertwined to be useful > apart from the other. I use sparsemem on my non-NUMA 2 CPU laptop since > it has a 1GB hole. It is *possible* to use DISCONTIG without NUMA, and > I'm sure people use it this way, but I just personally think it is a bit > of a pain. > > Basically, to add sparsemem support for an architecture, you need a > header like these: > > dave@nimitz:~/lse/linux/2.5/linux-2.6.git$ find | grep sparse | xargs > grep -c '^.*$' > ./include/asm-powerpc/sparsemem.h:32 > ./include/asm-x86/sparsemem.h:34 > ./include/asm-sh/sparsemem.h:16 > ./include/asm-mips/sparsemem.h:14 > ./include/asm-ia64/sparsemem.h:20 > ./include/asm-s390/sparsemem.h:18 > ./include/asm-arm/sparsemem.h:10 > > These are generally pretty darn small (the largest is 34 lines). You > also need to tweak some things in your per-arch Kconfig. ARM looks like > a pretty simple use of sparsemem. You might want to start with what > they've done. We tried really, really hard to make it easy to add to > new architectures. > > Feel free to cc me and Andy (cc'd) on the patches that you come up with. > I'd be happy to sanity check them for you. If *you* want to document > the process for the next guy, I'm sure we'd be able to find some spot in > Documentation/ so the next guy has an easier time. :) Always interested in new users of sparsemem. Cc me :). -apw -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from rtp-core-2.cisco.com (rtp-core-2.cisco.com [64.102.124.13]) by rtp-dkim-1.cisco.com (8.12.11/8.12.11) with ESMTP id m6UGNWG5011806 for ; Wed, 30 Jul 2008 12:23:32 -0400 Received: from sausatlsmtp1.sciatl.com ([192.133.217.33]) by rtp-core-2.cisco.com (8.13.8/8.13.8) with ESMTP id m6UGNW8d025889 for ; Wed, 30 Jul 2008 16:23:32 GMT Message-ID: <4890957F.6080705@sciatl.com> Date: Wed, 30 Jul 2008 09:23:27 -0700 From: C Michael Sundius MIME-Version: 1.0 Subject: Re: sparcemem or discontig? References: <488F5D5F.9010006@sciatl.com> <1217368281.13228.72.camel@nimitz> <20080730093552.GD1369@brain> In-Reply-To: <20080730093552.GD1369@brain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Andy Whitcroft Cc: Dave Hansen , linux-mm@kvack.org, msundius@sundius.com List-ID: Andy Whitcroft wrote: > On Tue, Jul 29, 2008 at 02:51:21PM -0700, Dave Hansen wrote: > >> On Tue, 2008-07-29 at 11:11 -0700, C Michael Sundius wrote: >> >>> My understanding is that SPARCEMEM is the way of the future, and since >>> I don't really have a NUMA machine, maybe sparcemem is more appropriate, >>> yes? On the other hand I can't find much info about how it works or how >>> to add support for it on an architecture that has here-to-fore not >>> supported that option. >>> >>> Is there anywhere that there is a paper or rfp that describes how the >>> spacemem (or discontig) features work (and/or the differences between >>> then)? >>> >> I think you're talking about sparsemem. :) >> >> My opinion is that NUMA and DISCONTIG are too intertwined to be useful >> apart from the other. I use sparsemem on my non-NUMA 2 CPU laptop since >> it has a 1GB hole. It is *possible* to use DISCONTIG without NUMA, and >> I'm sure people use it this way, but I just personally think it is a bit >> of a pain. >> >> Basically, to add sparsemem support for an architecture, you need a >> header like these: >> >> dave@nimitz:~/lse/linux/2.5/linux-2.6.git$ find | grep sparse | xargs >> grep -c '^.*$' >> ./include/asm-powerpc/sparsemem.h:32 >> ./include/asm-x86/sparsemem.h:34 >> ./include/asm-sh/sparsemem.h:16 >> ./include/asm-mips/sparsemem.h:14 >> ./include/asm-ia64/sparsemem.h:20 >> ./include/asm-s390/sparsemem.h:18 >> ./include/asm-arm/sparsemem.h:10 >> >> These are generally pretty darn small (the largest is 34 lines). You >> also need to tweak some things in your per-arch Kconfig. ARM looks like >> a pretty simple use of sparsemem. You might want to start with what >> they've done. We tried really, really hard to make it easy to add to >> new architectures. >> Pardon my ignorance, but is sparcemem independent of the bootmem allocator? We also use highmem. I noticed that all of our kmap and kmap_atomic code is located in the arch/mips directory. Is the sparcemem also independent of that? should I expect that I will have to make some changes in that... >> Feel free to cc me and Andy (cc'd) on the patches that you come up with. >> I'd be happy to sanity check them for you. If *you* want to document >> the process for the next guy, I'm sure we'd be able to find some spot in >> Documentation/ so the next guy has an easier time. :) >> I'm happy to write a how to for sparcemem. - - - - - Cisco - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e1.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m6UGTxXU008740 for ; Wed, 30 Jul 2008 12:29:59 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m6UGTxQx177826 for ; Wed, 30 Jul 2008 12:29:59 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m6UGTv78013391 for ; Wed, 30 Jul 2008 12:29:58 -0400 Subject: Re: sparcemem or discontig? From: Dave Hansen In-Reply-To: <4890957F.6080705@sciatl.com> References: <488F5D5F.9010006@sciatl.com> <1217368281.13228.72.camel@nimitz> <20080730093552.GD1369@brain> <4890957F.6080705@sciatl.com> Content-Type: text/plain Date: Wed, 30 Jul 2008 09:29:53 -0700 Message-Id: <1217435393.18919.18.camel@nimitz> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: C Michael Sundius Cc: Andy Whitcroft , linux-mm@kvack.org, msundius@sundius.com List-ID: On Wed, 2008-07-30 at 09:23 -0700, C Michael Sundius wrote: > Pardon my ignorance, but is sparcemem independent of the bootmem allocator? Yes, it really don't have much to do with bootmem. > We also use highmem. I noticed that all of our kmap and kmap_atomic code > is located > in the arch/mips directory. Is the sparcemem also independent of that? > should I expect > that I will have to make some changes in that... No, I don't think you'll need any changes to those. -- Dave -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sj-core-1.cisco.com (sj-core-1.cisco.com [171.71.177.237]) by sj-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id m75Ldw9B014063 for ; Tue, 5 Aug 2008 14:39:58 -0700 Received: from sausatlsmtp2.sciatl.com ([192.133.217.159]) by sj-core-1.cisco.com (8.13.8/8.13.8) with ESMTP id m75LdwIk018172 for ; Tue, 5 Aug 2008 21:39:58 GMT Message-ID: <4898C88E.9070006@sciatl.com> Date: Tue, 05 Aug 2008 14:39:26 -0700 From: C Michael Sundius MIME-Version: 1.0 Subject: Turning on Sparsemem References: <488F5D5F.9010006@sciatl.com> <1217368281.13228.72.camel@nimitz> <20080730093552.GD1369@brain> <4890957F.6080705@sciatl.com> In-Reply-To: <4890957F.6080705@sciatl.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Andy Whitcroft Cc: Dave Hansen , linux-mm@kvack.org, msundius@sundius.com List-ID: Hi Andy and Dave, I turned on sparsemem as you described before. I am crashing in the mem_init() function when I try a call to pfn_to_page(). I've noticed that that macro uses the sparsemem macro __pfn_to_section(pfn) and that intern calls __nr_to_section(nr). That finally looks at the mem_section[] variable. well.. this returns NULL since it seems as though my mem_section[] array looks to be not initialized correctly. QUESTION: where does this array get initialized. I've looked through the code and can't seem to see how that is initialized. recall I'm using mips32 processor, but I've looked in all the processors. it seems as though sparse_init() and memory present() both use __nr_to_section() and thus would require mem_section[] to be set up already. thanks for your help Mike - - - - - Cisco - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e35.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m75LuQnO023430 for ; Tue, 5 Aug 2008 17:56:26 -0400 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m75LuP0a178622 for ; Tue, 5 Aug 2008 15:56:25 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m75LuPkE024081 for ; Tue, 5 Aug 2008 15:56:25 -0600 Subject: Re: Turning on Sparsemem From: Dave Hansen In-Reply-To: <4898C88E.9070006@sciatl.com> References: <488F5D5F.9010006@sciatl.com> <1217368281.13228.72.camel@nimitz> <20080730093552.GD1369@brain> <4890957F.6080705@sciatl.com> <4898C88E.9070006@sciatl.com> Content-Type: text/plain Date: Tue, 05 Aug 2008 14:56:24 -0700 Message-Id: <1217973384.10907.70.camel@nimitz> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: C Michael Sundius Cc: Andy Whitcroft , linux-mm@kvack.org, msundius@sundius.com List-ID: On Tue, 2008-08-05 at 14:39 -0700, C Michael Sundius wrote: > Hi Andy and Dave, > > I turned on sparsemem as you described before. I am crashing in > the mem_init() function when I try a call to pfn_to_page(). > > I've noticed that that macro uses the sparsemem macro > __pfn_to_section(pfn) and > that intern calls __nr_to_section(nr). That finally looks at the > mem_section[] variable. > well.. this returns NULL since it seems as though my mem_section[] array > looks > to be not initialized correctly. > > QUESTION: where does this array get initialized. I've looked through the > code and > can't seem to see how that is initialized. My first guess is that you're missing a call to sparse_init() in your architecture-specific code. On x86_32, we do that in paging_init(), just before zone_sizes_init() (arch/x86/mm/init_32.c). Before you call this, you'll also have to call memory_present(...) on the memory that you do have. But, you should probably already have done that. > recall I'm using mips32 processor, but I've looked in all the processors. > it seems as though sparse_init() and memory present() both use > __nr_to_section() > and thus would require mem_section[] to be set up already. __nr_to_section() is special. It takes a section number and just gives you back the 'struct mem_section'. It doesn't actually look into that mem_section and make sure it is valid, it just locates the data structure. -- Dave -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sj-core-5.cisco.com (sj-core-5.cisco.com [171.71.177.238]) by sj-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id m75M4cuH019685 for ; Tue, 5 Aug 2008 15:04:38 -0700 Received: from sausatlsmtp2.sciatl.com ([192.133.217.159]) by sj-core-5.cisco.com (8.13.8/8.13.8) with ESMTP id m75M4cC1028252 for ; Tue, 5 Aug 2008 22:04:38 GMT Message-ID: <4898CE71.60709@sciatl.com> Date: Tue, 05 Aug 2008 15:04:33 -0700 From: C Michael Sundius MIME-Version: 1.0 Subject: Re: Turning on Sparsemem References: <488F5D5F.9010006@sciatl.com> <1217368281.13228.72.camel@nimitz> <20080730093552.GD1369@brain> <4890957F.6080705@sciatl.com> <4898C88E.9070006@sciatl.com> <1217973384.10907.70.camel@nimitz> In-Reply-To: <1217973384.10907.70.camel@nimitz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Dave Hansen Cc: Andy Whitcroft , linux-mm@kvack.org, msundius@sundius.com List-ID: Dave Hansen wrote: > On Tue, 2008-08-05 at 14:39 -0700, C Michael Sundius wrote: > >> Hi Andy and Dave, >> >> I turned on sparsemem as you described before. I am crashing in >> the mem_init() function when I try a call to pfn_to_page(). >> >> I've noticed that that macro uses the sparsemem macro >> __pfn_to_section(pfn) and >> that intern calls __nr_to_section(nr). That finally looks at the >> mem_section[] variable. >> well.. this returns NULL since it seems as though my mem_section[] array >> looks >> to be not initialized correctly. >> >> QUESTION: where does this array get initialized. I've looked through the >> code and >> can't seem to see how that is initialized. >> > > My first guess is that you're missing a call to sparse_init() in your > architecture-specific code. On x86_32, we do that in paging_init(), > just before zone_sizes_init() (arch/x86/mm/init_32.c). > > Before you call this, you'll also have to call memory_present(...) on > the memory that you do have. But, you should probably already have done > that. > > yes I call sparse_init()..... My code might be not calling memory_present for some of the memory I'm looking at that right now. >> recall I'm using mips32 processor, but I've looked in all the processors. >> it seems as though sparse_init() and memory present() both use >> __nr_to_section() >> and thus would require mem_section[] to be set up already. >> > > __nr_to_section() is special. It takes a section number and just gives > you back the 'struct mem_section'. It doesn't actually look into that > mem_section and make sure it is valid, it just locates the data > structure. > > -- Dave > > still that code is strange to me: -------------code static inline struct mem_section *__nr_to_section(unsigned long nr) { if (!mem_section[SECTION_NR_TO_ROOT(nr)]) return NULL; return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; } -------------- on the first line of the function above, what does it mean "if not "? seems that returns true if the contents of that struct is "0"... but either way, doesn't that have to be initialized to something before it is called from memory_present()? mike - - - - - Cisco - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e1.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m75MJjV4014437 for ; Tue, 5 Aug 2008 18:19:45 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m75MJjUw220778 for ; Tue, 5 Aug 2008 18:19:45 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m75MJjOc028847 for ; Tue, 5 Aug 2008 18:19:45 -0400 Subject: Re: Turning on Sparsemem From: Dave Hansen In-Reply-To: <4898CE71.60709@sciatl.com> References: <488F5D5F.9010006@sciatl.com> <1217368281.13228.72.camel@nimitz> <20080730093552.GD1369@brain> <4890957F.6080705@sciatl.com> <4898C88E.9070006@sciatl.com> <1217973384.10907.70.camel@nimitz> <4898CE71.60709@sciatl.com> Content-Type: text/plain Date: Tue, 05 Aug 2008 15:19:38 -0700 Message-Id: <1217974778.10907.82.camel@nimitz> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: C Michael Sundius Cc: Andy Whitcroft , linux-mm@kvack.org, msundius@sundius.com List-ID: On Tue, 2008-08-05 at 15:04 -0700, C Michael Sundius wrote: > still that code is strange to me: > > -------------code > static inline struct mem_section *__nr_to_section(unsigned long nr) > { > if (!mem_section[SECTION_NR_TO_ROOT(nr)]) > return NULL; > return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; > } > > -------------- > > on the first line of the function above, what does it mean "if not > "? seems that returns true if > the contents of that struct is "0"... but either way, doesn't that have > to be initialized to something before > it is called from memory_present()? Yeah, this is confusing code. The goal here was to not have any #ifdefs for the normal vs. extreme cases. In the !EXTREME case, the mem_section[] array is statically allocated and that first check gets optimized out completely. We check for it, but the compiler kills that check. -- Dave -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org