linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: dhowells@redhat.com
Cc: torvalds@osdl.org, akpm@osdl.org, davidm@snapgear.com,
	linux-kernel@vger.kernel.org, uclinux-dev@uclinux.org
Subject: Re: [PATCH 9/14] FRV: CONFIG_MMU fixes
Date: Tue, 2 Nov 2004 09:43:36 +0000	[thread overview]
Message-ID: <20041102094336.GC5841@infradead.org> (raw)
In-Reply-To: <200411011930.iA1JULvA023219@warthog.cambridge.redhat.com>

this is a real ifdef mess, let's sort this out better (aka on file
boundaries)

> 
> diff -uNr /warthog/kernels/linux-2.6.10-rc1-bk10/fs/proc/kcore.c linux-2.6.10-rc1-bk10-frv/fs/proc/kcore.c
> --- /warthog/kernels/linux-2.6.10-rc1-bk10/fs/proc/kcore.c	2004-09-16 12:06:14.000000000 +0100
> +++ linux-2.6.10-rc1-bk10-frv/fs/proc/kcore.c	2004-11-01 11:47:04.872656796 +0000
> @@ -344,6 +344,7 @@
>  		if (m == NULL) {
>  			if (clear_user(buffer, tsz))
>  				return -EFAULT;
> +#ifdef CONFIG_MMU
>  		} else if ((start >= VMALLOC_START) && (start < VMALLOC_END)) {
>  			char * elf_buf;
>  			struct vm_struct *m;
> @@ -389,6 +390,7 @@
>  				return -EFAULT;
>  			}
>  			kfree(elf_buf);
> +#endif

move this into a helper function that can be compiled away for the !MMU case

> --- /warthog/kernels/linux-2.6.10-rc1-bk10/fs/proc/proc_misc.c	2004-11-01 11:45:28.000000000 +0000
> +++ linux-2.6.10-rc1-bk10-frv/fs/proc/proc_misc.c	2004-11-01 11:47:04.873656713 +0000
> @@ -100,6 +100,7 @@
>  	unsigned long largest_chunk;
>  };
>  
> +#ifdef CONFIG_MMU
>  static struct vmalloc_info get_vmalloc_info(void)
>  {
>  	unsigned long prev_end = VMALLOC_START;
> @@ -129,6 +130,7 @@
>  	read_unlock(&vmlist_lock);
>  	return vmi;
>  }
> +#endif

move the whole function to a CONFIG_MMU-only file

>  static int uptime_read_proc(char *page, char **start, off_t off,
>  				 int count, int *eof, void *data)
> @@ -176,10 +178,16 @@
>  	allowed = ((totalram_pages - hugetlb_total_pages())
>  		* sysctl_overcommit_ratio / 100) + total_swap_pages;
>  
> +#ifdef CONFIG_MMU
>  	vmtot = (VMALLOC_END-VMALLOC_START)>>10;
>  	vmi = get_vmalloc_info();
>  	vmi.used >>= 10;
>  	vmi.largest_chunk >>= 10;
> +#else
> +	vmtot = 0;
> +	vmi.used = 0;
> +	vmi.largest_chunk = 0;
> +#endif

add a small helper for this.  In fact it's the only caller of get_vmalloc_info,
so that could be merged into the helper, ala:


void get_vmalloc_info(struct vmalloc_info vmi *vmi)
{
	/* contents of old get_vmalloc_info here */
	vmi->used = 0;
	vmi->largest_chunk = 0;
	}
}

and define both VMALLOC_START and VMALLOC_END to 0 for !MMU

> --- /warthog/kernels/linux-2.6.10-rc1-bk10/include/linux/mm.h	2004-11-01 11:45:33.371274107 +0000
> +++ linux-2.6.10-rc1-bk10-frv/include/linux/mm.h	2004-11-01 14:16:26.408497251 +0000
> @@ -58,6 +58,7 @@
>   * space that has a special rule for the page-fault handlers (ie a shared
>   * library, the executable area etc).
>   */
> +#ifdef CONFIG_MMU
>  struct vm_area_struct {
>  	struct mm_struct * vm_mm;	/* The address space we belong to. */
>  	unsigned long vm_start;		/* Our start address within vm_mm. */
> @@ -658,12 +688,14 @@

you're missing an endif.

>  	for (prio_tree_iter_init(iter, root, begin, end), vma = NULL;	\
>  		(vma = vma_prio_tree_next(vma, iter)); )
>  
> +#ifdef CONFIG_MMU
>  static inline void vma_nonlinear_insert(struct vm_area_struct *vma,
>  					struct list_head *list)
>  {
>  	vma->shared.vm_set.parent = NULL;
>  	list_add_tail(&vma->shared.vm_set.list, list);
>  }
> +#endif

I's day just move this out of line into a MMU-only file.

>  /* mmap.c */
>  extern void vma_adjust(struct vm_area_struct *vma, unsigned long start,
> @@ -780,6 +812,7 @@
>  }
>  #endif /* CONFIG_PROC_FS */
>  
> +#ifdef CONFIG_MMU
>  static inline void vm_stat_account(struct vm_area_struct *vma)
>  {
>  	__vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
> @@ -791,6 +824,7 @@
>  	__vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
>  							-vma_pages(vma));
>  }
> +#endif

or at least keep a single MMU ifdef block per file

> +#ifdef CONFIG_MMU
>  	pgtable_cache_init();
>  	prio_tree_init();
> +#endif

provide stubs please.  pgtable_cache_init is a per-arch things anyway.

> diff -uNr /warthog/kernels/linux-2.6.10-rc1-bk10/kernel/sysctl.c linux-2.6.10-rc1-bk10-frv/kernel/sysctl.c
> --- /warthog/kernels/linux-2.6.10-rc1-bk10/kernel/sysctl.c	2004-11-01 11:45:34.879148578 +0000
> +++ linux-2.6.10-rc1-bk10-frv/kernel/sysctl.c	2004-11-01 11:47:05.181631075 +0000
> @@ -755,6 +755,7 @@
>  		.strategy	= &sysctl_intvec,
>  		.extra1		= &zero,
>  	},
> +#ifdef CONFIG_MMU
>  	{
>  		.ctl_name	= VM_MAX_MAP_COUNT,
>  		.procname	= "max_map_count",
> @@ -763,6 +764,7 @@
>  		.mode		= 0644,
>  		.proc_handler	= &proc_dointvec
>  	},
> +#endif

just move the whole systctl registration into a MMU-only file

also please split this patch up into individual, small ones

  reply	other threads:[~2004-11-02 10:10 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <76b4a884-2c3c-11d9-91a1-0002b3163499@redhat.com>
2004-11-01 19:30 ` [PATCH 4/14] FRV: Bitops fixes dhowells
2004-11-02  8:19   ` Andrew Morton
2004-11-01 19:30 ` [PATCH 3/14] FRV: Fujitsu FR-V arch documentation dhowells
2004-11-01 19:30 ` [PATCH 5/14] FRV: Fork fixes dhowells
2004-11-01 19:30 ` [PATCH 8/14] FRV: GP-REL data support dhowells
2004-11-02  8:18   ` Andrew Morton
2004-11-02  9:48   ` Christoph Hellwig
2004-11-02 16:34   ` David Howells
2004-11-03 10:42     ` Christoph Hellwig
2004-11-01 19:30 ` [PATCH 11/14] FRV: Add FDPIC ELF binary format driver dhowells
2004-11-02  8:18   ` Andrew Morton
2004-11-02 11:07   ` Andrew Morton
2004-11-02 16:47   ` David Howells
2004-11-02 17:23     ` Andi Kleen
2004-11-01 19:30 ` [PATCH 10/14] FRV: Make calibrate_delay() optional dhowells
2004-11-02  0:06   ` john stultz
2004-11-02  8:17   ` Andrew Morton
2004-11-02  9:36   ` Christoph Hellwig
2004-11-02 11:01   ` David Howells
2004-11-02 16:29   ` David Howells
2004-11-03 10:40     ` Christoph Hellwig
2004-11-01 19:30 ` [PATCH 9/14] FRV: CONFIG_MMU fixes dhowells
2004-11-02  9:43   ` Christoph Hellwig [this message]
2004-11-03 15:06   ` David Howells
2004-11-03 15:13     ` Christoph Hellwig
2004-11-03 15:30     ` David Howells
2004-11-01 19:30 ` [PATCH 7/14] FRV: GDB stub dependent additional BUG()'s dhowells
2004-11-02  9:34   ` Christoph Hellwig
2004-11-02 16:09   ` David Howells
2004-11-03 10:39     ` Christoph Hellwig
2004-11-03 13:41     ` David Howells
2004-11-01 19:30 ` [PATCH 6/14] FRV: IDE fixes dhowells
2004-11-01 22:53   ` Alan Cox
2004-11-02  0:13     ` Bartlomiej Zolnierkiewicz
2004-11-02 10:57     ` David Howells
2004-11-01 19:30 ` [PATCH 13/14] FRV: Convert extern inline -> static inline dhowells
2004-11-01 19:30 ` [PATCH 12/14] FRV: Generate more useful debug info dhowells
2004-11-02  0:29   ` Andrew Morton
2004-11-02 11:21   ` David Howells
2004-11-03  1:48     ` Linus Torvalds
2004-11-03  1:52       ` Linus Torvalds
2004-11-03 20:40         ` Florian Weimer
2004-11-03 20:42           ` Linus Torvalds
2004-11-03 13:38       ` David Howells
2004-11-03 15:32         ` Linus Torvalds
2004-11-12 14:57     ` Daniel Jacobowitz
2004-11-12 15:15     ` David Howells
2004-11-12 15:20       ` Daniel Jacobowitz
     [not found] ` <20040401020550.GG3150@beast>
2004-11-01 19:30   ` [PATCH 14/14] FRV: Better mmap support in uClinux dhowells
2004-11-02  9:54     ` Christoph Hellwig
2004-11-02 16:43     ` David Howells
2004-11-03 10:45       ` Christoph Hellwig
2004-11-08 14:34   ` [PATCH 17/20] " dhowells
2004-11-09 12:57     ` Christoph Hellwig
2004-11-09 13:55     ` David Howells
2004-11-09 14:02       ` Christoph Hellwig
2004-11-19  5:29     ` Matt Mackall
2004-11-19 16:26     ` David Howells
2004-11-19 16:56       ` Matt Mackall
2004-11-19 17:06       ` David Howells
2004-11-19 17:42         ` Linus Torvalds
2004-11-02  0:21 ` [PATCH 1/14] FRV: Fujitsu FR-V CPU arch implementation Andrew Morton
2004-11-02 23:46 ` [uClinux-dev] " Christoph Hellwig
     [not found] ` <200411011930.iA1JUKFH023161@warthog.cambridge.redhat.com>
2004-11-02 23:24   ` [uClinux-dev] [PATCH 2/14] FRV: Fujitsu FR-V arch include files Christoph Hellwig
2004-11-03 17:26   ` David Howells
2004-11-03 19:46 ` [uClinux-dev] [PATCH 1/14] FRV: Fujitsu FR-V CPU arch implementation David Howells
2004-11-03 20:32   ` Christoph Hellwig
2004-11-04 11:54 ` David Howells
2004-11-08 14:34 [PATCH 1/20] FRV: Fujitsu FR-V CPU arch maintainer record dhowells
2004-11-08 14:34 ` [PATCH 2/20] FRV: Fujitsu FR-V arch documentation dhowells
2004-11-08 14:34 ` [PATCH 6/20] FRV: Fujitsu FR-V CPU arch implementation part 4 dhowells
2004-11-08 14:34 ` [PATCH 4/20] FRV: Fujitsu FR-V CPU arch implementation part 2 dhowells
2004-11-08 14:34 ` [PATCH 5/20] FRV: Fujitsu FR-V CPU arch implementation part 3 dhowells
2004-11-08 14:34 ` [PATCH 7/20] FRV: Fujitsu FR-V CPU arch implementation part 5 dhowells
2004-11-09 15:09   ` Geert Uytterhoeven
2004-11-08 14:34 ` [PATCH 3/20] FRV: Fujitsu FR-V CPU arch implementation part 1 dhowells
2004-11-08 14:34 ` [PATCH 8/20] FRV: Fujitsu FR-V CPU arch implementation part 6 dhowells
2004-11-08 14:34 ` [PATCH 9/20] FRV: Fujitsu FR-V CPU arch implementation part 7 dhowells
2004-11-08 14:34 ` [PATCH 11/20] FRV: Fujitsu FR-V CPU arch implementation part 9 dhowells
2004-11-08 14:34 ` [PATCH 10/20] FRV: Fujitsu FR-V CPU arch implementation part 8 dhowells
2004-11-08 14:34 ` [PATCH 15/20] FRV: Fujitsu FR-V arch include files dhowells
2004-11-08 14:34 ` [PATCH 16/20] FRV: Make calibrate_delay() optional dhowells
2004-11-08 14:34 ` [PATCH 14/20] FRV: Fujitsu FR-V arch include files dhowells
2004-11-08 14:34 ` [PATCH 13/20] " dhowells
2004-11-08 14:34 ` [PATCH 18/20] FRV: procfs changes for nommu changes dhowells
2004-11-08 14:34 ` [PATCH 20/20] FRV: Add FDPIC ELF binary format driver dhowells
2004-11-08 14:34 ` [PATCH 19/20] FRV: change setup_arg_pages() to take stack pointer dhowells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041102094336.GC5841@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@osdl.org \
    --cc=davidm@snapgear.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=uclinux-dev@uclinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).