Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 06:30:36PM +0800, Real Name wrote: > On Mon, Jun 16, 2014 at 11:15:23AM +0200, Geert Uytterhoeven wrote: > > On Mon, Jun 16, 2014 at 10:28 AM, Real Name wrote: > > >> > >> Can you please include in the changelog the commit sha1 which made > > >> > >> the old init_maps() obsolete? > > hi, > > The commit sha1 had been included as required. Please review the attached > patch. > I only update the changlog of the patch. > hi, Rechard ping? > thanks > > > > > > I think we need find out which commit deleted the line "mem_map = map;" > > > in init_maps function. > > > > > > v2.6.12-rc1 > > > > commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 > > Geert, thank you. > > > Author: Dave Hansen > > Date: Sun Mar 13 00:22:56 2005 -0800 > > > > [PATCH] no arch-specific mem_map init > > > From 29e5e83f8f3988ea1396d61b4d5764e7904f82c5 Mon Sep 17 00:00:00 2001 > From: Honggang Li > Date: Mon, 16 Jun 2014 18:05:47 +0800 > Subject: [PATCH] UML delete unnecessary bootmem struct page array > > 1) uml kernel bootmem managed through bootmem_data->node_bootmem_map, > not the struct page array, so the array is unnecessary. > > 2) the bootmem struct page array has been pointed by a *local* pointer, > struct page *map, in init_maps function. The array can be accessed only > in init_maps's scope. As a result, uml kernel wastes about 1% of total > memory. > > 3) commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 obsoleted > the init_maps function. > > Signed-off-by: Honggang Li > --- > arch/um/include/shared/mem_user.h | 2 +- > arch/um/kernel/physmem.c | 32 ++-- > arch/um/kernel/um_arch.c | 7 +-- > 3 files changed, 8 insertions(+), 33 deletions(-) > > diff --git a/arch/um/include/shared/mem_user.h > b/arch/um/include/shared/mem_user.h > index 46384ac..cb84414 100644 > --- a/arch/um/include/shared/mem_user.h > +++ b/arch/um/include/shared/mem_user.h > @@ -49,7 +49,7 @@ extern int iomem_size; > extern int init_mem_user(void); > extern void setup_memory(void *entry); > extern unsigned long find_iomem(char *driver, unsigned long *len_out); > -extern int init_maps(unsigned long physmem, unsigned long iomem, > +extern void mem_total_pages(unsigned long physmem, unsigned long iomem, >unsigned long highmem); > extern unsigned long get_vm(unsigned long len); > extern void setup_physmem(unsigned long start, unsigned long usable, > diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c > index 30fdd5d..549ecf3 100644 > --- a/arch/um/kernel/physmem.c > +++ b/arch/um/kernel/physmem.c > @@ -22,39 +22,19 @@ EXPORT_SYMBOL(high_physmem); > > extern unsigned long long physmem_size; > > -int __init init_maps(unsigned long physmem, unsigned long iomem, > +void __init mem_total_pages(unsigned long physmem, unsigned long iomem, >unsigned long highmem) > { > - struct page *p, *map; > - unsigned long phys_len, phys_pages, highmem_len, highmem_pages; > - unsigned long iomem_len, iomem_pages, total_len, total_pages; > - int i; > - > - phys_pages = physmem >> PAGE_SHIFT; > - phys_len = phys_pages * sizeof(struct page); > - > - iomem_pages = iomem >> PAGE_SHIFT; > - iomem_len = iomem_pages * sizeof(struct page); > + unsigned long phys_pages, highmem_pages; > + unsigned long iomem_pages, total_pages; > > + phys_pages= physmem >> PAGE_SHIFT; > + iomem_pages = iomem >> PAGE_SHIFT; > highmem_pages = highmem >> PAGE_SHIFT; > - highmem_len = highmem_pages * sizeof(struct page); > - > - total_pages = phys_pages + iomem_pages + highmem_pages; > - total_len = phys_len + iomem_len + highmem_len; > > - map = alloc_bootmem_low_pages(total_len); > - if (map == NULL) > - return -ENOMEM; > - > - for (i = 0; i < total_pages; i++) { > - p = [i]; > - memset(p, 0, sizeof(struct page)); > - SetPageReserved(p); > - INIT_LIST_HEAD(>lru); > - } > + total_pages = phys_pages + iomem_pages + highmem_pages; > > max_mapnr = total_pages; > - return 0; > } > > void map_memory(unsigned long virt, unsigned long phys, unsigned long len, > diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c > index 6043c76..dbd5bda 100644 > --- a/arch/um/kernel/um_arch.c > +++ b/arch/um/kernel/um_arch.c > @@ -338,12 +338,7 @@ int __init linux_main(int argc, char **argv) > start_vm = VMALLOC_START; > > setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); > - if (init_maps(physmem_size, iomem_size, highmem)) { > - printf("Failed to allocate mem_map for %Lu bytes of physical " > -"memory and %Lu bytes of highmem\n", physmem_size, > -highmem); > - exit(1); > - } > + mem_total_pages(physmem_size, iomem_size, highmem); > > virtmem_size = physmem_size; >
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 06:30:36PM +0800, Real Name wrote: On Mon, Jun 16, 2014 at 11:15:23AM +0200, Geert Uytterhoeven wrote: On Mon, Jun 16, 2014 at 10:28 AM, Real Name enjoymind...@gmail.com wrote: Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? hi, The commit sha1 had been included as required. Please review the attached patch. I only update the changlog of the patch. hi, Rechard ping? thanks I think we need find out which commit deleted the line mem_map = map; in init_maps function. v2.6.12-rc1 commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 Geert, thank you. Author: Dave Hansen haveb...@us.ibm.com Date: Sun Mar 13 00:22:56 2005 -0800 [PATCH] no arch-specific mem_map init From 29e5e83f8f3988ea1396d61b4d5764e7904f82c5 Mon Sep 17 00:00:00 2001 From: Honggang Li enjoymind...@gmail.com Date: Mon, 16 Jun 2014 18:05:47 +0800 Subject: [PATCH] UML delete unnecessary bootmem struct page array 1) uml kernel bootmem managed through bootmem_data-node_bootmem_map, not the struct page array, so the array is unnecessary. 2) the bootmem struct page array has been pointed by a *local* pointer, struct page *map, in init_maps function. The array can be accessed only in init_maps's scope. As a result, uml kernel wastes about 1% of total memory. 3) commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 obsoleted the init_maps function. Signed-off-by: Honggang Li enjoymind...@gmail.com --- arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/arch/um/include/shared/mem_user.h b/arch/um/include/shared/mem_user.h index 46384ac..cb84414 100644 --- a/arch/um/include/shared/mem_user.h +++ b/arch/um/include/shared/mem_user.h @@ -49,7 +49,7 @@ extern int iomem_size; extern int init_mem_user(void); extern void setup_memory(void *entry); extern unsigned long find_iomem(char *driver, unsigned long *len_out); -extern int init_maps(unsigned long physmem, unsigned long iomem, +extern void mem_total_pages(unsigned long physmem, unsigned long iomem, unsigned long highmem); extern unsigned long get_vm(unsigned long len); extern void setup_physmem(unsigned long start, unsigned long usable, diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 30fdd5d..549ecf3 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -22,39 +22,19 @@ EXPORT_SYMBOL(high_physmem); extern unsigned long long physmem_size; -int __init init_maps(unsigned long physmem, unsigned long iomem, +void __init mem_total_pages(unsigned long physmem, unsigned long iomem, unsigned long highmem) { - struct page *p, *map; - unsigned long phys_len, phys_pages, highmem_len, highmem_pages; - unsigned long iomem_len, iomem_pages, total_len, total_pages; - int i; - - phys_pages = physmem PAGE_SHIFT; - phys_len = phys_pages * sizeof(struct page); - - iomem_pages = iomem PAGE_SHIFT; - iomem_len = iomem_pages * sizeof(struct page); + unsigned long phys_pages, highmem_pages; + unsigned long iomem_pages, total_pages; + phys_pages= physmem PAGE_SHIFT; + iomem_pages = iomemPAGE_SHIFT; highmem_pages = highmem PAGE_SHIFT; - highmem_len = highmem_pages * sizeof(struct page); - - total_pages = phys_pages + iomem_pages + highmem_pages; - total_len = phys_len + iomem_len + highmem_len; - map = alloc_bootmem_low_pages(total_len); - if (map == NULL) - return -ENOMEM; - - for (i = 0; i total_pages; i++) { - p = map[i]; - memset(p, 0, sizeof(struct page)); - SetPageReserved(p); - INIT_LIST_HEAD(p-lru); - } + total_pages = phys_pages + iomem_pages + highmem_pages; max_mapnr = total_pages; - return 0; } void map_memory(unsigned long virt, unsigned long phys, unsigned long len, diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 6043c76..dbd5bda 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -338,12 +338,7 @@ int __init linux_main(int argc, char **argv) start_vm = VMALLOC_START; setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); - if (init_maps(physmem_size, iomem_size, highmem)) { - printf(Failed to allocate mem_map for %Lu bytes of physical -memory and %Lu bytes of highmem\n, physmem_size, -highmem); - exit(1); - } + mem_total_pages(physmem_size, iomem_size, highmem); virtmem_size = physmem_size; stack = (unsigned long) argv; -- 1.8.3.1 -- To unsubscribe from this list: send the
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 11:15:23AM +0200, Geert Uytterhoeven wrote: > On Mon, Jun 16, 2014 at 10:28 AM, Real Name wrote: > >> > >> Can you please include in the changelog the commit sha1 which made > >> > >> the old init_maps() obsolete? hi, The commit sha1 had been included as required. Please review the attached patch. I only update the changlog of the patch. thanks > > > > I think we need find out which commit deleted the line "mem_map = map;" in > > init_maps function. > > > v2.6.12-rc1 > > commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 Geert, thank you. > Author: Dave Hansen > Date: Sun Mar 13 00:22:56 2005 -0800 > > [PATCH] no arch-specific mem_map init > >From 29e5e83f8f3988ea1396d61b4d5764e7904f82c5 Mon Sep 17 00:00:00 2001 From: Honggang Li Date: Mon, 16 Jun 2014 18:05:47 +0800 Subject: [PATCH] UML delete unnecessary bootmem struct page array 1) uml kernel bootmem managed through bootmem_data->node_bootmem_map, not the struct page array, so the array is unnecessary. 2) the bootmem struct page array has been pointed by a *local* pointer, struct page *map, in init_maps function. The array can be accessed only in init_maps's scope. As a result, uml kernel wastes about 1% of total memory. 3) commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 obsoleted the init_maps function. Signed-off-by: Honggang Li --- arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/arch/um/include/shared/mem_user.h b/arch/um/include/shared/mem_user.h index 46384ac..cb84414 100644 --- a/arch/um/include/shared/mem_user.h +++ b/arch/um/include/shared/mem_user.h @@ -49,7 +49,7 @@ extern int iomem_size; extern int init_mem_user(void); extern void setup_memory(void *entry); extern unsigned long find_iomem(char *driver, unsigned long *len_out); -extern int init_maps(unsigned long physmem, unsigned long iomem, +extern void mem_total_pages(unsigned long physmem, unsigned long iomem, unsigned long highmem); extern unsigned long get_vm(unsigned long len); extern void setup_physmem(unsigned long start, unsigned long usable, diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 30fdd5d..549ecf3 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -22,39 +22,19 @@ EXPORT_SYMBOL(high_physmem); extern unsigned long long physmem_size; -int __init init_maps(unsigned long physmem, unsigned long iomem, +void __init mem_total_pages(unsigned long physmem, unsigned long iomem, unsigned long highmem) { - struct page *p, *map; - unsigned long phys_len, phys_pages, highmem_len, highmem_pages; - unsigned long iomem_len, iomem_pages, total_len, total_pages; - int i; - - phys_pages = physmem >> PAGE_SHIFT; - phys_len = phys_pages * sizeof(struct page); - - iomem_pages = iomem >> PAGE_SHIFT; - iomem_len = iomem_pages * sizeof(struct page); + unsigned long phys_pages, highmem_pages; + unsigned long iomem_pages, total_pages; + phys_pages= physmem >> PAGE_SHIFT; + iomem_pages = iomem >> PAGE_SHIFT; highmem_pages = highmem >> PAGE_SHIFT; - highmem_len = highmem_pages * sizeof(struct page); - - total_pages = phys_pages + iomem_pages + highmem_pages; - total_len = phys_len + iomem_len + highmem_len; - map = alloc_bootmem_low_pages(total_len); - if (map == NULL) - return -ENOMEM; - - for (i = 0; i < total_pages; i++) { - p = [i]; - memset(p, 0, sizeof(struct page)); - SetPageReserved(p); - INIT_LIST_HEAD(>lru); - } + total_pages = phys_pages + iomem_pages + highmem_pages; max_mapnr = total_pages; - return 0; } void map_memory(unsigned long virt, unsigned long phys, unsigned long len, diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 6043c76..dbd5bda 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -338,12 +338,7 @@ int __init linux_main(int argc, char **argv) start_vm = VMALLOC_START; setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); - if (init_maps(physmem_size, iomem_size, highmem)) { - printf("Failed to allocate mem_map for %Lu bytes of physical " - "memory and %Lu bytes of highmem\n", physmem_size, - highmem); - exit(1); - } + mem_total_pages(physmem_size, iomem_size, highmem); virtmem_size = physmem_size; stack = (unsigned long) argv; -- 1.8.3.1
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 10:28 AM, Real Name wrote: >> > >> Can you please include in the changelog the commit sha1 which made the >> > >> old init_maps() obsolete? > > I think we need find out which commit deleted the line "mem_map = map;" in > init_maps function. marc.info/?l=linux-kernel=11102410474=2 v2.6.12-rc1 commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 Author: Dave Hansen Date: Sun Mar 13 00:22:56 2005 -0800 [PATCH] no arch-specific mem_map init So, this patch started out with me trying to keep from passing contiguous, node-specific mem_map into free_area_init_node() and cousins. Instead, I relied on some calls to pfn_to_page(). This works fine and dandy when all you need is the pgdat->node_mem_map to do pfn_to_page(). However, the non-NUMA/DISCONTIG architectures use the real, global mem_map[] instead of a node_mem_map in the pfn_to_page() calculation. So, I ended up effectively trying to initialize mem_map from itself, when it was NULL. That was bad, and caused some very pretty colors on someone's screen when he tested it. So, I had to make sure to initialize the global mem_map[] before calling into free_area_init_node(). Then, I realized how many architectures do this on their own, and have comments like this: /* XXX: MRB-remove - this doesn't seem sane, should this be done som mem_map = NODE_DATA(0)->node_mem_map; The following patch does what my first one did (don't pass mem_map into the init functions), incorporates Jesse Barnes' ia64 fixes on top of that, and gets rid of all but one of the global mem_map initializations (parisc is weird). It also magically removes more code than it adds. It could be smaller, but I shamelessly added some comments. Boot-tested on ppc64, i386 (NUMAQ, plain SMP, laptop), UML (i386). Signed-off-by: Dave Hansen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 04:12:38PM +0800, Real Name wrote: > On Mon, Jun 16, 2014 at 08:50:33AM +0200, Richard Weinberger wrote: > > > > > > Am 16.06.2014 05:28, schrieb Real Name: > > > On Sat, Jun 14, 2014 at 11:44:04AM +0200, Richard Weinberger wrote: > > >> Hi! > > >> > > >> Am 03.06.2014 07:30, schrieb Real Name: > > >>> From: Honggang Li > > >>> > > >>> The patch based on linux-next-2014-06-02. > > >>> > > >>> The old init_maps function does two things: > > >>> 1) allocates and initializes one struct page array for bootmem > > >>> 2) count the number of total pages > > >>> > > >>> After removed the source code related to the unnecessary array, the > > >>> name > > >>> 'init_maps' is some kind of improper named, as it just count the number > > >>> of > > >>> total page numbers. So, I renamed the function as 'mem_total_pages'. > > >>> > > >>> I tested the patch through repeat reboot the uml kernel many times. > > >>> [real@name linux-next]$ make ARCH=um defconfig > > >>> [real@name linux-next]$ make ARCH=um linux > > >>> [real@name linux-next]$ file linux > > >>> linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically > > >>> linked (uses shared libs), for GNU/Linux 2.6.32, not stripped > > >>> [real@name linux-next]$ ./linux > > >>> ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && > > >>> echo 1 > > >>> [real@name linux-next]$ ./linux > > >>> ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && > > >>> echo 2 > > >>> (repeat reboot the uml kernel many times..) > > >> > > >> Can you please include in the changelog the commit sha1 which made the > > >> old init_maps() obsolete? I think we need find out which commit deleted the line "mem_map = map;" in init_maps function. > > >> I had a look at the pre-git linux tree, looks like init_maps() wasn't > > >> touched for more than 10 years. > > > > > > hi, richard > > > > > > what is the pre-git linux tree? I searched it with google, but failed. > > > > > > The v2.6.12 kernel is the oldest one available from the linux-next git > > > tree. And it has duplicated > > > struct page arrays. So, any suggestion how to find the commit you wanted? > > > > > https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git > > richard, geert, and paul > thanks all of you for the git-pre info. > > > > > > linux-2.4.20 + uml-patch-2.4.20-8 works on *old* redhat-9 virtual > > > machine. And it seems has duplicated > > > struct page array too. > > > > > > > And if you remove it here too UML still works? > > yes, it works. I removed the code related struct page array in init_maps. > > Please check the attachments. > > [root@rht9 root]# /root/linux-2.4.20/linux > ubda=/root/uml/root_fs.rh-7.2-server.pristine.20020312 mem=256m 2>&1 | tee > /tmp/log.txt > > thanks > > > > > Thanks, > > //richard > > > > > The first struct page array > > > > > > linux-2.4.20/arch/um/kernel/physmem.c > > > 157 int init_maps(unsigned long len) > > > 158 { > > > 159 struct page *p, *map; > > > 160 int i, n; > > > 161 > > > 162 n = len >> PAGE_SHIFT; > > > 163 len = n * sizeof(struct page); > > > 164 > > > 165 if(kmalloc_ok){ > > > 166 map = kmalloc(len, GFP_KERNEL); > > > 167 if(map == NULL) map = vmalloc(len); > > > 168 } > > > 169 else map = alloc_bootmem_low_pages(len); > > > 170 > > > 171 if(map == NULL) > > > 172 return(-ENOMEM); > > > 173 > > > 174 for(i = 0; i < n; i++){ > > > 175 p = [i]; > > > 176 set_page_count(p, 0); > > > 177 SetPageReserved(p); > > > 178 INIT_LIST_HEAD(>list); > > > 179 } > > > 180 > > > 181 mem_map = map; > > > 182 max_mapnr = n; > > > 183 return(0); > > > 184 } > > > > > > > > > The second struct page array > > > --- > > > mm/memory.c > > > 73 mem_map_t * mem_map; // global define > > > > > > mm/page_alloc.c > > > 839 void __init free_area_init(unsigned long *zones_size) > > > 840 { > > > 841 free_area_init_core(0, _page_data, _map, > > > zones_size, 0, 0, 0); > > > 842 } > > > > > > > > > mm/page_alloc.c > > > 685 void __init free_area_init_core(int nid, pg_data_t *pgdat, struct > > > page **gmap, > > > 686 unsigned long *zones_size, unsigned long zone_start_paddr, > > > 687 unsigned long *zholes_size, struct page *lmem_map) > > > 688 { > > > > > > 716 map_size = (totalpages + 1)*sizeof(struct page); > > > 717 if (lmem_map == (struct page *)0) { > > > 718 lmem_map = (struct page *) alloc_bootmem_node(pgdat, > > > map_size); > > > 719 lmem_map = (struct page *)(PAGE_OFFSET + > > > 720 MAP_ALIGN((unsigned long)lmem_map - > > > PAGE_OFFSET)); > > > 721 } > > > 722 *gmap =
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 08:50:33AM +0200, Richard Weinberger wrote: > > > Am 16.06.2014 05:28, schrieb Real Name: > > On Sat, Jun 14, 2014 at 11:44:04AM +0200, Richard Weinberger wrote: > >> Hi! > >> > >> Am 03.06.2014 07:30, schrieb Real Name: > >>> From: Honggang Li > >>> > >>> The patch based on linux-next-2014-06-02. > >>> > >>> The old init_maps function does two things: > >>> 1) allocates and initializes one struct page array for bootmem > >>> 2) count the number of total pages > >>> > >>> After removed the source code related to the unnecessary array, the name > >>> 'init_maps' is some kind of improper named, as it just count the number of > >>> total page numbers. So, I renamed the function as 'mem_total_pages'. > >>> > >>> I tested the patch through repeat reboot the uml kernel many times. > >>> [real@name linux-next]$ make ARCH=um defconfig > >>> [real@name linux-next]$ make ARCH=um linux > >>> [real@name linux-next]$ file linux > >>> linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically > >>> linked (uses shared libs), for GNU/Linux 2.6.32, not stripped > >>> [real@name linux-next]$ ./linux > >>> ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && > >>> echo 1 > >>> [real@name linux-next]$ ./linux > >>> ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && > >>> echo 2 > >>> (repeat reboot the uml kernel many times..) > >> > >> Can you please include in the changelog the commit sha1 which made the old > >> init_maps() obsolete? > >> I had a look at the pre-git linux tree, looks like init_maps() wasn't > >> touched for more than 10 years. > > > > hi, richard > > > > what is the pre-git linux tree? I searched it with google, but failed. > > > > The v2.6.12 kernel is the oldest one available from the linux-next git > > tree. And it has duplicated > > struct page arrays. So, any suggestion how to find the commit you wanted? > > https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git richard, geert, and paul thanks all of you for the git-pre info. > > > linux-2.4.20 + uml-patch-2.4.20-8 works on *old* redhat-9 virtual machine. > > And it seems has duplicated > > struct page array too. > > > > And if you remove it here too UML still works? yes, it works. I removed the code related struct page array in init_maps. Please check the attachments. [root@rht9 root]# /root/linux-2.4.20/linux ubda=/root/uml/root_fs.rh-7.2-server.pristine.20020312 mem=256m 2>&1 | tee /tmp/log.txt thanks > > Thanks, > //richard > > > The first struct page array > > > > linux-2.4.20/arch/um/kernel/physmem.c > > 157 int init_maps(unsigned long len) > > 158 { > > 159 struct page *p, *map; > > 160 int i, n; > > 161 > > 162 n = len >> PAGE_SHIFT; > > 163 len = n * sizeof(struct page); > > 164 > > 165 if(kmalloc_ok){ > > 166 map = kmalloc(len, GFP_KERNEL); > > 167 if(map == NULL) map = vmalloc(len); > > 168 } > > 169 else map = alloc_bootmem_low_pages(len); > > 170 > > 171 if(map == NULL) > > 172 return(-ENOMEM); > > 173 > > 174 for(i = 0; i < n; i++){ > > 175 p = [i]; > > 176 set_page_count(p, 0); > > 177 SetPageReserved(p); > > 178 INIT_LIST_HEAD(>list); > > 179 } > > 180 > > 181 mem_map = map; > > 182 max_mapnr = n; > > 183 return(0); > > 184 } > > > > > > The second struct page array > > --- > > mm/memory.c > > 73 mem_map_t * mem_map; // global define > > > > mm/page_alloc.c > > 839 void __init free_area_init(unsigned long *zones_size) > > 840 { > > 841 free_area_init_core(0, _page_data, _map, zones_size, > > 0, 0, 0); > > 842 } > > > > > > mm/page_alloc.c > > 685 void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page > > **gmap, > > 686 unsigned long *zones_size, unsigned long zone_start_paddr, > > 687 unsigned long *zholes_size, struct page *lmem_map) > > 688 { > > > > 716 map_size = (totalpages + 1)*sizeof(struct page); > > 717 if (lmem_map == (struct page *)0) { > > 718 lmem_map = (struct page *) alloc_bootmem_node(pgdat, > > map_size); > > 719 lmem_map = (struct page *)(PAGE_OFFSET + > > 720 MAP_ALIGN((unsigned long)lmem_map - > > PAGE_OFFSET)); > > 721 } > > 722 *gmap = pgdat->node_mem_map = lmem_map; > > > > > >> > >> Thanks, > >> //richard > >> > >>> Honggang Li (1): > >>> delete unnecessary bootmem struct page array > >>> > >>> arch/um/include/shared/mem_user.h | 2 +- > >>> arch/um/kernel/physmem.c | 32 ++-- > >>> arch/um/kernel/um_arch.c | 7 +-- > >>> 3 files changed, 8 insertions(+), 33 deletions(-) > >>> --- physmem.c.old 2014-06-16 07:35:27.0 -0400
Re: [uml-devel] [PATCH v2] delete unnecessary bootmem struct page array
On Mon, 2014-06-16 at 08:58 +0200, Geert Uytterhoeven wrote: > On Mon, Jun 16, 2014 at 5:28 AM, Real Name wrote: > > what is the pre-git linux tree? I searched it with google, but failed. > > E.g. git.kernel.org/cgit/linux/kernel/git/tglx/history.git/ The archive at https://archive.org/details/git-history-of-linux seems to be the most comprehensive. I use it regularly. It can even be made to track the current tree. The tags for pre-v2.6.12-rc2 releases need to be added manually, which is quite a bit of work. Is there something better out there? Paul Bolle -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [uml-devel] [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 5:28 AM, Real Name wrote: > what is the pre-git linux tree? I searched it with google, but failed. E.g. git.kernel.org/cgit/linux/kernel/git/tglx/history.git/ -- Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
Am 16.06.2014 05:28, schrieb Real Name: > On Sat, Jun 14, 2014 at 11:44:04AM +0200, Richard Weinberger wrote: >> Hi! >> >> Am 03.06.2014 07:30, schrieb Real Name: >>> From: Honggang Li >>> >>> The patch based on linux-next-2014-06-02. >>> >>> The old init_maps function does two things: >>> 1) allocates and initializes one struct page array for bootmem >>> 2) count the number of total pages >>> >>> After removed the source code related to the unnecessary array, the name >>> 'init_maps' is some kind of improper named, as it just count the number of >>> total page numbers. So, I renamed the function as 'mem_total_pages'. >>> >>> I tested the patch through repeat reboot the uml kernel many times. >>> [real@name linux-next]$ make ARCH=um defconfig >>> [real@name linux-next]$ make ARCH=um linux >>> [real@name linux-next]$ file linux >>> linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically >>> linked (uses shared libs), for GNU/Linux 2.6.32, not stripped >>> [real@name linux-next]$ ./linux >>> ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 1 >>> [real@name linux-next]$ ./linux >>> ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 2 >>> (repeat reboot the uml kernel many times..) >> >> Can you please include in the changelog the commit sha1 which made the old >> init_maps() obsolete? >> I had a look at the pre-git linux tree, looks like init_maps() wasn't >> touched for more than 10 years. > > hi, richard > > what is the pre-git linux tree? I searched it with google, but failed. > > The v2.6.12 kernel is the oldest one available from the linux-next git tree. > And it has duplicated > struct page arrays. So, any suggestion how to find the commit you wanted? https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git > linux-2.4.20 + uml-patch-2.4.20-8 works on *old* redhat-9 virtual machine. > And it seems has duplicated > struct page array too. > And if you remove it here too UML still works? Thanks, //richard > The first struct page array > > linux-2.4.20/arch/um/kernel/physmem.c > 157 int init_maps(unsigned long len) > 158 { > 159 struct page *p, *map; > 160 int i, n; > 161 > 162 n = len >> PAGE_SHIFT; > 163 len = n * sizeof(struct page); > 164 > 165 if(kmalloc_ok){ > 166 map = kmalloc(len, GFP_KERNEL); > 167 if(map == NULL) map = vmalloc(len); > 168 } > 169 else map = alloc_bootmem_low_pages(len); > 170 > 171 if(map == NULL) > 172 return(-ENOMEM); > 173 > 174 for(i = 0; i < n; i++){ > 175 p = [i]; > 176 set_page_count(p, 0); > 177 SetPageReserved(p); > 178 INIT_LIST_HEAD(>list); > 179 } > 180 > 181 mem_map = map; > 182 max_mapnr = n; > 183 return(0); > 184 } > > > The second struct page array > --- > mm/memory.c > 73 mem_map_t * mem_map; // global define > > mm/page_alloc.c > 839 void __init free_area_init(unsigned long *zones_size) > 840 { > 841 free_area_init_core(0, _page_data, _map, zones_size, > 0, 0, 0); > 842 } > > > mm/page_alloc.c > 685 void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page > **gmap, > 686 unsigned long *zones_size, unsigned long zone_start_paddr, > 687 unsigned long *zholes_size, struct page *lmem_map) > 688 { > > 716 map_size = (totalpages + 1)*sizeof(struct page); > 717 if (lmem_map == (struct page *)0) { > 718 lmem_map = (struct page *) alloc_bootmem_node(pgdat, > map_size); > 719 lmem_map = (struct page *)(PAGE_OFFSET + > 720 MAP_ALIGN((unsigned long)lmem_map - PAGE_OFFSET)); > 721 } > 722 *gmap = pgdat->node_mem_map = lmem_map; > > >> >> Thanks, >> //richard >> >>> Honggang Li (1): >>> delete unnecessary bootmem struct page array >>> >>> arch/um/include/shared/mem_user.h | 2 +- >>> arch/um/kernel/physmem.c | 32 ++-- >>> arch/um/kernel/um_arch.c | 7 +-- >>> 3 files changed, 8 insertions(+), 33 deletions(-) >>> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
Am 16.06.2014 05:28, schrieb Real Name: On Sat, Jun 14, 2014 at 11:44:04AM +0200, Richard Weinberger wrote: Hi! Am 03.06.2014 07:30, schrieb Real Name: From: Honggang Li enjoymind...@gmail.com The patch based on linux-next-2014-06-02. The old init_maps function does two things: 1) allocates and initializes one struct page array for bootmem 2) count the number of total pages After removed the source code related to the unnecessary array, the name 'init_maps' is some kind of improper named, as it just count the number of total page numbers. So, I renamed the function as 'mem_total_pages'. I tested the patch through repeat reboot the uml kernel many times. [real@name linux-next]$ make ARCH=um defconfig [real@name linux-next]$ make ARCH=um linux [real@name linux-next]$ file linux linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 1 [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 2 (repeat reboot the uml kernel many times..) Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? I had a look at the pre-git linux tree, looks like init_maps() wasn't touched for more than 10 years. hi, richard what is the pre-git linux tree? I searched it with google, but failed. The v2.6.12 kernel is the oldest one available from the linux-next git tree. And it has duplicated struct page arrays. So, any suggestion how to find the commit you wanted? https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git linux-2.4.20 + uml-patch-2.4.20-8 works on *old* redhat-9 virtual machine. And it seems has duplicated struct page array too. And if you remove it here too UML still works? Thanks, //richard The first struct page array linux-2.4.20/arch/um/kernel/physmem.c 157 int init_maps(unsigned long len) 158 { 159 struct page *p, *map; 160 int i, n; 161 162 n = len PAGE_SHIFT; 163 len = n * sizeof(struct page); 164 165 if(kmalloc_ok){ 166 map = kmalloc(len, GFP_KERNEL); 167 if(map == NULL) map = vmalloc(len); 168 } 169 else map = alloc_bootmem_low_pages(len); 170 171 if(map == NULL) 172 return(-ENOMEM); 173 174 for(i = 0; i n; i++){ 175 p = map[i]; 176 set_page_count(p, 0); 177 SetPageReserved(p); 178 INIT_LIST_HEAD(p-list); 179 } 180 181 mem_map = map; 182 max_mapnr = n; 183 return(0); 184 } The second struct page array --- mm/memory.c 73 mem_map_t * mem_map; // global define mm/page_alloc.c 839 void __init free_area_init(unsigned long *zones_size) 840 { 841 free_area_init_core(0, contig_page_data, mem_map, zones_size, 0, 0, 0); 842 } mm/page_alloc.c 685 void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, 686 unsigned long *zones_size, unsigned long zone_start_paddr, 687 unsigned long *zholes_size, struct page *lmem_map) 688 { 716 map_size = (totalpages + 1)*sizeof(struct page); 717 if (lmem_map == (struct page *)0) { 718 lmem_map = (struct page *) alloc_bootmem_node(pgdat, map_size); 719 lmem_map = (struct page *)(PAGE_OFFSET + 720 MAP_ALIGN((unsigned long)lmem_map - PAGE_OFFSET)); 721 } 722 *gmap = pgdat-node_mem_map = lmem_map; Thanks, //richard Honggang Li (1): delete unnecessary bootmem struct page array arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [uml-devel] [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 5:28 AM, Real Name enjoymind...@gmail.com wrote: what is the pre-git linux tree? I searched it with google, but failed. E.g. git.kernel.org/cgit/linux/kernel/git/tglx/history.git/ -- Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [uml-devel] [PATCH v2] delete unnecessary bootmem struct page array
On Mon, 2014-06-16 at 08:58 +0200, Geert Uytterhoeven wrote: On Mon, Jun 16, 2014 at 5:28 AM, Real Name enjoymind...@gmail.com wrote: what is the pre-git linux tree? I searched it with google, but failed. E.g. git.kernel.org/cgit/linux/kernel/git/tglx/history.git/ The archive at https://archive.org/details/git-history-of-linux seems to be the most comprehensive. I use it regularly. It can even be made to track the current tree. The tags for pre-v2.6.12-rc2 releases need to be added manually, which is quite a bit of work. Is there something better out there? Paul Bolle -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 08:50:33AM +0200, Richard Weinberger wrote: Am 16.06.2014 05:28, schrieb Real Name: On Sat, Jun 14, 2014 at 11:44:04AM +0200, Richard Weinberger wrote: Hi! Am 03.06.2014 07:30, schrieb Real Name: From: Honggang Li enjoymind...@gmail.com The patch based on linux-next-2014-06-02. The old init_maps function does two things: 1) allocates and initializes one struct page array for bootmem 2) count the number of total pages After removed the source code related to the unnecessary array, the name 'init_maps' is some kind of improper named, as it just count the number of total page numbers. So, I renamed the function as 'mem_total_pages'. I tested the patch through repeat reboot the uml kernel many times. [real@name linux-next]$ make ARCH=um defconfig [real@name linux-next]$ make ARCH=um linux [real@name linux-next]$ file linux linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 1 [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 2 (repeat reboot the uml kernel many times..) Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? I had a look at the pre-git linux tree, looks like init_maps() wasn't touched for more than 10 years. hi, richard what is the pre-git linux tree? I searched it with google, but failed. The v2.6.12 kernel is the oldest one available from the linux-next git tree. And it has duplicated struct page arrays. So, any suggestion how to find the commit you wanted? https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git richard, geert, and paul thanks all of you for the git-pre info. linux-2.4.20 + uml-patch-2.4.20-8 works on *old* redhat-9 virtual machine. And it seems has duplicated struct page array too. And if you remove it here too UML still works? yes, it works. I removed the code related struct page array in init_maps. Please check the attachments. [root@rht9 root]# /root/linux-2.4.20/linux ubda=/root/uml/root_fs.rh-7.2-server.pristine.20020312 mem=256m 21 | tee /tmp/log.txt thanks Thanks, //richard The first struct page array linux-2.4.20/arch/um/kernel/physmem.c 157 int init_maps(unsigned long len) 158 { 159 struct page *p, *map; 160 int i, n; 161 162 n = len PAGE_SHIFT; 163 len = n * sizeof(struct page); 164 165 if(kmalloc_ok){ 166 map = kmalloc(len, GFP_KERNEL); 167 if(map == NULL) map = vmalloc(len); 168 } 169 else map = alloc_bootmem_low_pages(len); 170 171 if(map == NULL) 172 return(-ENOMEM); 173 174 for(i = 0; i n; i++){ 175 p = map[i]; 176 set_page_count(p, 0); 177 SetPageReserved(p); 178 INIT_LIST_HEAD(p-list); 179 } 180 181 mem_map = map; 182 max_mapnr = n; 183 return(0); 184 } The second struct page array --- mm/memory.c 73 mem_map_t * mem_map; // global define mm/page_alloc.c 839 void __init free_area_init(unsigned long *zones_size) 840 { 841 free_area_init_core(0, contig_page_data, mem_map, zones_size, 0, 0, 0); 842 } mm/page_alloc.c 685 void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, 686 unsigned long *zones_size, unsigned long zone_start_paddr, 687 unsigned long *zholes_size, struct page *lmem_map) 688 { 716 map_size = (totalpages + 1)*sizeof(struct page); 717 if (lmem_map == (struct page *)0) { 718 lmem_map = (struct page *) alloc_bootmem_node(pgdat, map_size); 719 lmem_map = (struct page *)(PAGE_OFFSET + 720 MAP_ALIGN((unsigned long)lmem_map - PAGE_OFFSET)); 721 } 722 *gmap = pgdat-node_mem_map = lmem_map; Thanks, //richard Honggang Li (1): delete unnecessary bootmem struct page array arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) --- physmem.c.old 2014-06-16 07:35:27.0 -0400 +++ physmem.c 2014-06-16 07:40:38.0 -0400 @@ -156,29 +156,10 @@ int init_maps(unsigned long len) { - struct page *p, *map; - int i, n; + int n; n = len PAGE_SHIFT; - len = n * sizeof(struct page); - if(kmalloc_ok){ - map = kmalloc(len, GFP_KERNEL); - if(map == NULL) map = vmalloc(len); - } -
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 04:12:38PM +0800, Real Name wrote: On Mon, Jun 16, 2014 at 08:50:33AM +0200, Richard Weinberger wrote: Am 16.06.2014 05:28, schrieb Real Name: On Sat, Jun 14, 2014 at 11:44:04AM +0200, Richard Weinberger wrote: Hi! Am 03.06.2014 07:30, schrieb Real Name: From: Honggang Li enjoymind...@gmail.com The patch based on linux-next-2014-06-02. The old init_maps function does two things: 1) allocates and initializes one struct page array for bootmem 2) count the number of total pages After removed the source code related to the unnecessary array, the name 'init_maps' is some kind of improper named, as it just count the number of total page numbers. So, I renamed the function as 'mem_total_pages'. I tested the patch through repeat reboot the uml kernel many times. [real@name linux-next]$ make ARCH=um defconfig [real@name linux-next]$ make ARCH=um linux [real@name linux-next]$ file linux linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 1 [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 2 (repeat reboot the uml kernel many times..) Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? I think we need find out which commit deleted the line mem_map = map; in init_maps function. I had a look at the pre-git linux tree, looks like init_maps() wasn't touched for more than 10 years. hi, richard what is the pre-git linux tree? I searched it with google, but failed. The v2.6.12 kernel is the oldest one available from the linux-next git tree. And it has duplicated struct page arrays. So, any suggestion how to find the commit you wanted? https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git richard, geert, and paul thanks all of you for the git-pre info. linux-2.4.20 + uml-patch-2.4.20-8 works on *old* redhat-9 virtual machine. And it seems has duplicated struct page array too. And if you remove it here too UML still works? yes, it works. I removed the code related struct page array in init_maps. Please check the attachments. [root@rht9 root]# /root/linux-2.4.20/linux ubda=/root/uml/root_fs.rh-7.2-server.pristine.20020312 mem=256m 21 | tee /tmp/log.txt thanks Thanks, //richard The first struct page array linux-2.4.20/arch/um/kernel/physmem.c 157 int init_maps(unsigned long len) 158 { 159 struct page *p, *map; 160 int i, n; 161 162 n = len PAGE_SHIFT; 163 len = n * sizeof(struct page); 164 165 if(kmalloc_ok){ 166 map = kmalloc(len, GFP_KERNEL); 167 if(map == NULL) map = vmalloc(len); 168 } 169 else map = alloc_bootmem_low_pages(len); 170 171 if(map == NULL) 172 return(-ENOMEM); 173 174 for(i = 0; i n; i++){ 175 p = map[i]; 176 set_page_count(p, 0); 177 SetPageReserved(p); 178 INIT_LIST_HEAD(p-list); 179 } 180 181 mem_map = map; 182 max_mapnr = n; 183 return(0); 184 } The second struct page array --- mm/memory.c 73 mem_map_t * mem_map; // global define mm/page_alloc.c 839 void __init free_area_init(unsigned long *zones_size) 840 { 841 free_area_init_core(0, contig_page_data, mem_map, zones_size, 0, 0, 0); 842 } mm/page_alloc.c 685 void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, 686 unsigned long *zones_size, unsigned long zone_start_paddr, 687 unsigned long *zholes_size, struct page *lmem_map) 688 { 716 map_size = (totalpages + 1)*sizeof(struct page); 717 if (lmem_map == (struct page *)0) { 718 lmem_map = (struct page *) alloc_bootmem_node(pgdat, map_size); 719 lmem_map = (struct page *)(PAGE_OFFSET + 720 MAP_ALIGN((unsigned long)lmem_map - PAGE_OFFSET)); 721 } 722 *gmap = pgdat-node_mem_map = lmem_map; Thanks, //richard Honggang Li (1): delete unnecessary bootmem struct page array arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) --- physmem.c.old 2014-06-16 07:35:27.0
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 10:28 AM, Real Name enjoymind...@gmail.com wrote: Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? I think we need find out which commit deleted the line mem_map = map; in init_maps function. marc.info/?l=linux-kernelm=11102410474w=2 v2.6.12-rc1 commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 Author: Dave Hansen haveb...@us.ibm.com Date: Sun Mar 13 00:22:56 2005 -0800 [PATCH] no arch-specific mem_map init So, this patch started out with me trying to keep from passing contiguous, node-specific mem_map into free_area_init_node() and cousins. Instead, I relied on some calls to pfn_to_page(). This works fine and dandy when all you need is the pgdat-node_mem_map to do pfn_to_page(). However, the non-NUMA/DISCONTIG architectures use the real, global mem_map[] instead of a node_mem_map in the pfn_to_page() calculation. So, I ended up effectively trying to initialize mem_map from itself, when it was NULL. That was bad, and caused some very pretty colors on someone's screen when he tested it. So, I had to make sure to initialize the global mem_map[] before calling into free_area_init_node(). Then, I realized how many architectures do this on their own, and have comments like this: /* XXX: MRB-remove - this doesn't seem sane, should this be done som mem_map = NODE_DATA(0)-node_mem_map; The following patch does what my first one did (don't pass mem_map into the init functions), incorporates Jesse Barnes' ia64 fixes on top of that, and gets rid of all but one of the global mem_map initializations (parisc is weird). It also magically removes more code than it adds. It could be smaller, but I shamelessly added some comments. Boot-tested on ppc64, i386 (NUMAQ, plain SMP, laptop), UML (i386). Signed-off-by: Dave Hansen haveb...@us.ibm.com Signed-off-by: Andrew Morton a...@osdl.org Signed-off-by: Linus Torvalds torva...@osdl.org Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Mon, Jun 16, 2014 at 11:15:23AM +0200, Geert Uytterhoeven wrote: On Mon, Jun 16, 2014 at 10:28 AM, Real Name enjoymind...@gmail.com wrote: Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? hi, The commit sha1 had been included as required. Please review the attached patch. I only update the changlog of the patch. thanks I think we need find out which commit deleted the line mem_map = map; in init_maps function. v2.6.12-rc1 commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 Geert, thank you. Author: Dave Hansen haveb...@us.ibm.com Date: Sun Mar 13 00:22:56 2005 -0800 [PATCH] no arch-specific mem_map init From 29e5e83f8f3988ea1396d61b4d5764e7904f82c5 Mon Sep 17 00:00:00 2001 From: Honggang Li enjoymind...@gmail.com Date: Mon, 16 Jun 2014 18:05:47 +0800 Subject: [PATCH] UML delete unnecessary bootmem struct page array 1) uml kernel bootmem managed through bootmem_data-node_bootmem_map, not the struct page array, so the array is unnecessary. 2) the bootmem struct page array has been pointed by a *local* pointer, struct page *map, in init_maps function. The array can be accessed only in init_maps's scope. As a result, uml kernel wastes about 1% of total memory. 3) commit 5678d7fc97ac75f7401ce77897773cc0bb3afee5 obsoleted the init_maps function. Signed-off-by: Honggang Li enjoymind...@gmail.com --- arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/arch/um/include/shared/mem_user.h b/arch/um/include/shared/mem_user.h index 46384ac..cb84414 100644 --- a/arch/um/include/shared/mem_user.h +++ b/arch/um/include/shared/mem_user.h @@ -49,7 +49,7 @@ extern int iomem_size; extern int init_mem_user(void); extern void setup_memory(void *entry); extern unsigned long find_iomem(char *driver, unsigned long *len_out); -extern int init_maps(unsigned long physmem, unsigned long iomem, +extern void mem_total_pages(unsigned long physmem, unsigned long iomem, unsigned long highmem); extern unsigned long get_vm(unsigned long len); extern void setup_physmem(unsigned long start, unsigned long usable, diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 30fdd5d..549ecf3 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -22,39 +22,19 @@ EXPORT_SYMBOL(high_physmem); extern unsigned long long physmem_size; -int __init init_maps(unsigned long physmem, unsigned long iomem, +void __init mem_total_pages(unsigned long physmem, unsigned long iomem, unsigned long highmem) { - struct page *p, *map; - unsigned long phys_len, phys_pages, highmem_len, highmem_pages; - unsigned long iomem_len, iomem_pages, total_len, total_pages; - int i; - - phys_pages = physmem PAGE_SHIFT; - phys_len = phys_pages * sizeof(struct page); - - iomem_pages = iomem PAGE_SHIFT; - iomem_len = iomem_pages * sizeof(struct page); + unsigned long phys_pages, highmem_pages; + unsigned long iomem_pages, total_pages; + phys_pages= physmem PAGE_SHIFT; + iomem_pages = iomemPAGE_SHIFT; highmem_pages = highmem PAGE_SHIFT; - highmem_len = highmem_pages * sizeof(struct page); - - total_pages = phys_pages + iomem_pages + highmem_pages; - total_len = phys_len + iomem_len + highmem_len; - map = alloc_bootmem_low_pages(total_len); - if (map == NULL) - return -ENOMEM; - - for (i = 0; i total_pages; i++) { - p = map[i]; - memset(p, 0, sizeof(struct page)); - SetPageReserved(p); - INIT_LIST_HEAD(p-lru); - } + total_pages = phys_pages + iomem_pages + highmem_pages; max_mapnr = total_pages; - return 0; } void map_memory(unsigned long virt, unsigned long phys, unsigned long len, diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 6043c76..dbd5bda 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -338,12 +338,7 @@ int __init linux_main(int argc, char **argv) start_vm = VMALLOC_START; setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); - if (init_maps(physmem_size, iomem_size, highmem)) { - printf(Failed to allocate mem_map for %Lu bytes of physical - memory and %Lu bytes of highmem\n, physmem_size, - highmem); - exit(1); - } + mem_total_pages(physmem_size, iomem_size, highmem); virtmem_size = physmem_size; stack = (unsigned long) argv; -- 1.8.3.1
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Sat, Jun 14, 2014 at 11:44:04AM +0200, Richard Weinberger wrote: > Hi! > > Am 03.06.2014 07:30, schrieb Real Name: > > From: Honggang Li > > > > The patch based on linux-next-2014-06-02. > > > > The old init_maps function does two things: > > 1) allocates and initializes one struct page array for bootmem > > 2) count the number of total pages > > > > After removed the source code related to the unnecessary array, the name > > 'init_maps' is some kind of improper named, as it just count the number of > > total page numbers. So, I renamed the function as 'mem_total_pages'. > > > > I tested the patch through repeat reboot the uml kernel many times. > > [real@name linux-next]$ make ARCH=um defconfig > > [real@name linux-next]$ make ARCH=um linux > > [real@name linux-next]$ file linux > > linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically > > linked (uses shared libs), for GNU/Linux 2.6.32, not stripped > > [real@name linux-next]$ ./linux > > ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 1 > > [real@name linux-next]$ ./linux > > ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 2 > > (repeat reboot the uml kernel many times..) > > Can you please include in the changelog the commit sha1 which made the old > init_maps() obsolete? > I had a look at the pre-git linux tree, looks like init_maps() wasn't touched > for more than 10 years. hi, richard what is the pre-git linux tree? I searched it with google, but failed. The v2.6.12 kernel is the oldest one available from the linux-next git tree. And it has duplicated struct page arrays. So, any suggestion how to find the commit you wanted? linux-2.4.20 + uml-patch-2.4.20-8 works on *old* redhat-9 virtual machine. And it seems has duplicated struct page array too. The first struct page array linux-2.4.20/arch/um/kernel/physmem.c 157 int init_maps(unsigned long len) 158 { 159 struct page *p, *map; 160 int i, n; 161 162 n = len >> PAGE_SHIFT; 163 len = n * sizeof(struct page); 164 165 if(kmalloc_ok){ 166 map = kmalloc(len, GFP_KERNEL); 167 if(map == NULL) map = vmalloc(len); 168 } 169 else map = alloc_bootmem_low_pages(len); 170 171 if(map == NULL) 172 return(-ENOMEM); 173 174 for(i = 0; i < n; i++){ 175 p = [i]; 176 set_page_count(p, 0); 177 SetPageReserved(p); 178 INIT_LIST_HEAD(>list); 179 } 180 181 mem_map = map; 182 max_mapnr = n; 183 return(0); 184 } The second struct page array --- mm/memory.c 73 mem_map_t * mem_map; // global define mm/page_alloc.c 839 void __init free_area_init(unsigned long *zones_size) 840 { 841 free_area_init_core(0, _page_data, _map, zones_size, 0, 0, 0); 842 } mm/page_alloc.c 685 void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, 686 unsigned long *zones_size, unsigned long zone_start_paddr, 687 unsigned long *zholes_size, struct page *lmem_map) 688 { 716 map_size = (totalpages + 1)*sizeof(struct page); 717 if (lmem_map == (struct page *)0) { 718 lmem_map = (struct page *) alloc_bootmem_node(pgdat, map_size); 719 lmem_map = (struct page *)(PAGE_OFFSET + 720 MAP_ALIGN((unsigned long)lmem_map - PAGE_OFFSET)); 721 } 722 *gmap = pgdat->node_mem_map = lmem_map; > > Thanks, > //richard > > > Honggang Li (1): > > delete unnecessary bootmem struct page array > > > > arch/um/include/shared/mem_user.h | 2 +- > > arch/um/kernel/physmem.c | 32 ++-- > > arch/um/kernel/um_arch.c | 7 +-- > > 3 files changed, 8 insertions(+), 33 deletions(-) > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
On Sat, Jun 14, 2014 at 11:44:04AM +0200, Richard Weinberger wrote: Hi! Am 03.06.2014 07:30, schrieb Real Name: From: Honggang Li enjoymind...@gmail.com The patch based on linux-next-2014-06-02. The old init_maps function does two things: 1) allocates and initializes one struct page array for bootmem 2) count the number of total pages After removed the source code related to the unnecessary array, the name 'init_maps' is some kind of improper named, as it just count the number of total page numbers. So, I renamed the function as 'mem_total_pages'. I tested the patch through repeat reboot the uml kernel many times. [real@name linux-next]$ make ARCH=um defconfig [real@name linux-next]$ make ARCH=um linux [real@name linux-next]$ file linux linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 1 [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 2 (repeat reboot the uml kernel many times..) Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? I had a look at the pre-git linux tree, looks like init_maps() wasn't touched for more than 10 years. hi, richard what is the pre-git linux tree? I searched it with google, but failed. The v2.6.12 kernel is the oldest one available from the linux-next git tree. And it has duplicated struct page arrays. So, any suggestion how to find the commit you wanted? linux-2.4.20 + uml-patch-2.4.20-8 works on *old* redhat-9 virtual machine. And it seems has duplicated struct page array too. The first struct page array linux-2.4.20/arch/um/kernel/physmem.c 157 int init_maps(unsigned long len) 158 { 159 struct page *p, *map; 160 int i, n; 161 162 n = len PAGE_SHIFT; 163 len = n * sizeof(struct page); 164 165 if(kmalloc_ok){ 166 map = kmalloc(len, GFP_KERNEL); 167 if(map == NULL) map = vmalloc(len); 168 } 169 else map = alloc_bootmem_low_pages(len); 170 171 if(map == NULL) 172 return(-ENOMEM); 173 174 for(i = 0; i n; i++){ 175 p = map[i]; 176 set_page_count(p, 0); 177 SetPageReserved(p); 178 INIT_LIST_HEAD(p-list); 179 } 180 181 mem_map = map; 182 max_mapnr = n; 183 return(0); 184 } The second struct page array --- mm/memory.c 73 mem_map_t * mem_map; // global define mm/page_alloc.c 839 void __init free_area_init(unsigned long *zones_size) 840 { 841 free_area_init_core(0, contig_page_data, mem_map, zones_size, 0, 0, 0); 842 } mm/page_alloc.c 685 void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, 686 unsigned long *zones_size, unsigned long zone_start_paddr, 687 unsigned long *zholes_size, struct page *lmem_map) 688 { 716 map_size = (totalpages + 1)*sizeof(struct page); 717 if (lmem_map == (struct page *)0) { 718 lmem_map = (struct page *) alloc_bootmem_node(pgdat, map_size); 719 lmem_map = (struct page *)(PAGE_OFFSET + 720 MAP_ALIGN((unsigned long)lmem_map - PAGE_OFFSET)); 721 } 722 *gmap = pgdat-node_mem_map = lmem_map; Thanks, //richard Honggang Li (1): delete unnecessary bootmem struct page array arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
Hi! Am 03.06.2014 07:30, schrieb Real Name: > From: Honggang Li > > The patch based on linux-next-2014-06-02. > > The old init_maps function does two things: > 1) allocates and initializes one struct page array for bootmem > 2) count the number of total pages > > After removed the source code related to the unnecessary array, the name > 'init_maps' is some kind of improper named, as it just count the number of > total page numbers. So, I renamed the function as 'mem_total_pages'. > > I tested the patch through repeat reboot the uml kernel many times. > [real@name linux-next]$ make ARCH=um defconfig > [real@name linux-next]$ make ARCH=um linux > [real@name linux-next]$ file linux > linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically > linked (uses shared libs), for GNU/Linux 2.6.32, not stripped > [real@name linux-next]$ ./linux > ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 1 > [real@name linux-next]$ ./linux > ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 2 > (repeat reboot the uml kernel many times..) Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? I had a look at the pre-git linux tree, looks like init_maps() wasn't touched for more than 10 years. Thanks, //richard > Honggang Li (1): > delete unnecessary bootmem struct page array > > arch/um/include/shared/mem_user.h | 2 +- > arch/um/kernel/physmem.c | 32 ++-- > arch/um/kernel/um_arch.c | 7 +-- > 3 files changed, 8 insertions(+), 33 deletions(-) > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
Hi! Am 03.06.2014 07:30, schrieb Real Name: From: Honggang Li enjoymind...@gmail.com The patch based on linux-next-2014-06-02. The old init_maps function does two things: 1) allocates and initializes one struct page array for bootmem 2) count the number of total pages After removed the source code related to the unnecessary array, the name 'init_maps' is some kind of improper named, as it just count the number of total page numbers. So, I renamed the function as 'mem_total_pages'. I tested the patch through repeat reboot the uml kernel many times. [real@name linux-next]$ make ARCH=um defconfig [real@name linux-next]$ make ARCH=um linux [real@name linux-next]$ file linux linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 1 [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 2 (repeat reboot the uml kernel many times..) Can you please include in the changelog the commit sha1 which made the old init_maps() obsolete? I had a look at the pre-git linux tree, looks like init_maps() wasn't touched for more than 10 years. Thanks, //richard Honggang Li (1): delete unnecessary bootmem struct page array arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [uml-devel] [PATCH v2] delete unnecessary bootmem struct page array
On 06/09/2014 07:49 AM, Real Name wrote: > Hi, Richard > Any comment about this patch? > thanks > > On Tue, Jun 03, 2014 at 01:30:44PM +0800, Real Name wrote: >> From: Honggang Li Hi "Real Name", give Richard a little bit more time to comment/react. UML is rather a hobby of him in it spare time than his full time job. ;) -- Toralf -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [uml-devel] [PATCH v2] delete unnecessary bootmem struct page array
On 06/09/2014 07:49 AM, Real Name wrote: Hi, Richard Any comment about this patch? thanks On Tue, Jun 03, 2014 at 01:30:44PM +0800, Real Name wrote: From: Honggang Li enjoymind...@gmail.com Hi Real Name, give Richard a little bit more time to comment/react. UML is rather a hobby of him in it spare time than his full time job. ;) -- Toralf -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
Hi, Richard Any comment about this patch? thanks On Tue, Jun 03, 2014 at 01:30:44PM +0800, Real Name wrote: > From: Honggang Li > > The patch based on linux-next-2014-06-02. > > The old init_maps function does two things: > 1) allocates and initializes one struct page array for bootmem > 2) count the number of total pages > > After removed the source code related to the unnecessary array, the name > 'init_maps' is some kind of improper named, as it just count the number of > total page numbers. So, I renamed the function as 'mem_total_pages'. > > I tested the patch through repeat reboot the uml kernel many times. > [real@name linux-next]$ make ARCH=um defconfig > [real@name linux-next]$ make ARCH=um linux > [real@name linux-next]$ file linux > linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically > linked (uses shared libs), for GNU/Linux 2.6.32, not stripped > [real@name linux-next]$ ./linux > ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 1 > [real@name linux-next]$ ./linux > ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 2 > (repeat reboot the uml kernel many times..) > > Honggang Li (1): > delete unnecessary bootmem struct page array > > arch/um/include/shared/mem_user.h | 2 +- > arch/um/kernel/physmem.c | 32 ++-- > arch/um/kernel/um_arch.c | 7 +-- > 3 files changed, 8 insertions(+), 33 deletions(-) > > -- > 1.8.3.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] delete unnecessary bootmem struct page array
Hi, Richard Any comment about this patch? thanks On Tue, Jun 03, 2014 at 01:30:44PM +0800, Real Name wrote: From: Honggang Li enjoymind...@gmail.com The patch based on linux-next-2014-06-02. The old init_maps function does two things: 1) allocates and initializes one struct page array for bootmem 2) count the number of total pages After removed the source code related to the unnecessary array, the name 'init_maps' is some kind of improper named, as it just count the number of total page numbers. So, I renamed the function as 'mem_total_pages'. I tested the patch through repeat reboot the uml kernel many times. [real@name linux-next]$ make ARCH=um defconfig [real@name linux-next]$ make ARCH=um linux [real@name linux-next]$ file linux linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 1 [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 2 (repeat reboot the uml kernel many times..) Honggang Li (1): delete unnecessary bootmem struct page array arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] delete unnecessary bootmem struct page array
From: Honggang Li The patch based on linux-next-2014-06-02. The old init_maps function does two things: 1) allocates and initializes one struct page array for bootmem 2) count the number of total pages After removed the source code related to the unnecessary array, the name 'init_maps' is some kind of improper named, as it just count the number of total page numbers. So, I renamed the function as 'mem_total_pages'. I tested the patch through repeat reboot the uml kernel many times. [real@name linux-next]$ make ARCH=um defconfig [real@name linux-next]$ make ARCH=um linux [real@name linux-next]$ file linux linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 1 [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m && sync && echo 2 (repeat reboot the uml kernel many times..) Honggang Li (1): delete unnecessary bootmem struct page array arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] delete unnecessary bootmem struct page array
From: Honggang Li enjoymind...@gmail.com The patch based on linux-next-2014-06-02. The old init_maps function does two things: 1) allocates and initializes one struct page array for bootmem 2) count the number of total pages After removed the source code related to the unnecessary array, the name 'init_maps' is some kind of improper named, as it just count the number of total page numbers. So, I renamed the function as 'mem_total_pages'. I tested the patch through repeat reboot the uml kernel many times. [real@name linux-next]$ make ARCH=um defconfig [real@name linux-next]$ make ARCH=um linux [real@name linux-next]$ file linux linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 1 [real@name linux-next]$ ./linux ubda=/home/real/linux-next/Fedora20-AMD64-root_fs mem=256m sync echo 2 (repeat reboot the uml kernel many times..) Honggang Li (1): delete unnecessary bootmem struct page array arch/um/include/shared/mem_user.h | 2 +- arch/um/kernel/physmem.c | 32 ++-- arch/um/kernel/um_arch.c | 7 +-- 3 files changed, 8 insertions(+), 33 deletions(-) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/