linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] stub out is_swap_pte for !MMU
@ 2008-02-08 20:02 Mike Frysinger
  2008-02-08 20:49 ` Matt Mackall
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2008-02-08 20:02 UTC (permalink / raw)
  To: mpm, akpm; +Cc: linux-kernel

With commit 698dd4ba6b12e34e1e432c944c01478c0b2cd773, swap_pte() was moved
into view of both MMU and !MMU, but uses functions only provided by MMU.
Here we stub out the function for !MMU ports.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/linux/swapops.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 7bf2d14..e6b54f7 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -45,7 +45,11 @@ static inline pgoff_t swp_offset(swp_entry_t entry)
 /* check whether a pte points to a swap entry */
 static inline int is_swap_pte(pte_t pte)
 {
+#ifdef CONFIG_MMU
 	return !pte_none(pte) && !pte_present(pte) && !pte_file(pte);
+#else
+	return 0;
+#endif
 }
 
 /*
-- 
1.5.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] stub out is_swap_pte for !MMU
  2008-02-08 20:02 [PATCH] stub out is_swap_pte for !MMU Mike Frysinger
@ 2008-02-08 20:49 ` Matt Mackall
  2008-02-08 21:25   ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Mackall @ 2008-02-08 20:49 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: akpm, linux-kernel


On Fri, 2008-02-08 at 15:02 -0500, Mike Frysinger wrote:
> With commit 698dd4ba6b12e34e1e432c944c01478c0b2cd773, swap_pte() was moved
> into view of both MMU and !MMU, but uses functions only provided by MMU.
> Here we stub out the function for !MMU ports.

I'm not sure if this is right compared to my original patch. Does it
ever make sense to ask "is this pte a swap entry?" on a machine with no
MMU? Presumably this also means it has no ptes too, right? In which
case, it's better to comment the whole function out. Then when someone
tries to ask the above meaningless question, they get a compile error
rather than a meaningless answer.

> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  include/linux/swapops.h |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/swapops.h b/include/linux/swapops.h
> index 7bf2d14..e6b54f7 100644
> --- a/include/linux/swapops.h
> +++ b/include/linux/swapops.h
> @@ -45,7 +45,11 @@ static inline pgoff_t swp_offset(swp_entry_t entry)
>  /* check whether a pte points to a swap entry */
>  static inline int is_swap_pte(pte_t pte)
>  {
> +#ifdef CONFIG_MMU
>  	return !pte_none(pte) && !pte_present(pte) && !pte_file(pte);
> +#else
> +	return 0;
> +#endif
>  }
>  
>  /*
-- 
Mathematics is the supreme nostalgia of our time.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] stub out is_swap_pte for !MMU
  2008-02-08 20:49 ` Matt Mackall
@ 2008-02-08 21:25   ` Mike Frysinger
  2008-02-08 21:41     ` Matt Mackall
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2008-02-08 21:25 UTC (permalink / raw)
  To: Matt Mackall; +Cc: akpm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

On Friday 08 February 2008, Matt Mackall wrote:
> On Fri, 2008-02-08 at 15:02 -0500, Mike Frysinger wrote:
> > With commit 698dd4ba6b12e34e1e432c944c01478c0b2cd773, swap_pte() was
> > moved into view of both MMU and !MMU, but uses functions only provided by
> > MMU. Here we stub out the function for !MMU ports.
>
> I'm not sure if this is right compared to my original patch. Does it
> ever make sense to ask "is this pte a swap entry?" on a machine with no
> MMU? Presumably this also means it has no ptes too, right? In which
> case, it's better to comment the whole function out. Then when someone
> tries to ask the above meaningless question, they get a compile error
> rather than a meaningless answer.

honestly, doesnt matter to me since none of the code that currently utilizes 
this function is used in no-mmu context.  if you want to just put the whole 
thing in CONFIG_MMU, then go for it.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] stub out is_swap_pte for !MMU
  2008-02-08 21:25   ` Mike Frysinger
@ 2008-02-08 21:41     ` Matt Mackall
  2008-02-08 22:05       ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Mackall @ 2008-02-08 21:41 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: akpm, linux-kernel


On Fri, 2008-02-08 at 16:25 -0500, Mike Frysinger wrote:
> On Friday 08 February 2008, Matt Mackall wrote:
> > On Fri, 2008-02-08 at 15:02 -0500, Mike Frysinger wrote:
> > > With commit 698dd4ba6b12e34e1e432c944c01478c0b2cd773, swap_pte() was
> > > moved into view of both MMU and !MMU, but uses functions only provided by
> > > MMU. Here we stub out the function for !MMU ports.
> >
> > I'm not sure if this is right compared to my original patch. Does it
> > ever make sense to ask "is this pte a swap entry?" on a machine with no
> > MMU? Presumably this also means it has no ptes too, right? In which
> > case, it's better to comment the whole function out. Then when someone
> > tries to ask the above meaningless question, they get a compile error
> > rather than a meaningless answer.
> 
> honestly, doesnt matter to me since none of the code that currently utilizes 
> this function is used in no-mmu context.  if you want to just put the whole 
> thing in CONFIG_MMU, then go for it.

Here it is again, I'll leave it up to Andrew:

Fix compile error on nommu for is_swap_pte

Does it ever make sense to ask "is this pte a swap entry?" on a machine
with no MMU? Presumably this also means it has no ptes too, right? In
which case, it's better to comment the whole function out. Then when
someone tries to ask the above meaningless question, they get a compile
error rather than a meaningless answer.

Signed-off-by: Matt Mackall <mpm@selenic.com>

diff -r 50a6e531a9f2 include/linux/swapops.h
--- a/include/linux/swapops.h	Mon Feb 04 20:23:02 2008 -0600
+++ b/include/linux/swapops.h	Fri Feb 08 15:38:01 2008 -0600
@@ -42,11 +42,13 @@
 	return entry.val & SWP_OFFSET_MASK(entry);
 }
 
+#ifdef CONFIG_MMU
 /* check whether a pte points to a swap entry */
 static inline int is_swap_pte(pte_t pte)
 {
 	return !pte_none(pte) && !pte_present(pte) && !pte_file(pte);
 }
+#endif
 
 /*
  * Convert the arch-dependent pte representation of a swp_entry_t into an

-- 
Mathematics is the supreme nostalgia of our time.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] stub out is_swap_pte for !MMU
  2008-02-08 21:41     ` Matt Mackall
@ 2008-02-08 22:05       ` Andrew Morton
  2008-02-08 22:19         ` Matt Mackall
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2008-02-08 22:05 UTC (permalink / raw)
  To: Matt Mackall; +Cc: vapier, linux-kernel

On Fri, 08 Feb 2008 15:41:42 -0600
Matt Mackall <mpm@selenic.com> wrote:

> Fix compile error on nommu for is_swap_pte
> 
> Does it ever make sense to ask "is this pte a swap entry?" on a machine
> with no MMU? Presumably this also means it has no ptes too, right? In
> which case, it's better to comment the whole function out. Then when
> someone tries to ask the above meaningless question, they get a compile
> error rather than a meaningless answer.
> 
> Signed-off-by: Matt Mackall <mpm@selenic.com>
> 
> diff -r 50a6e531a9f2 include/linux/swapops.h
> --- a/include/linux/swapops.h	Mon Feb 04 20:23:02 2008 -0600
> +++ b/include/linux/swapops.h	Fri Feb 08 15:38:01 2008 -0600
> @@ -42,11 +42,13 @@
>  	return entry.val & SWP_OFFSET_MASK(entry);
>  }
>  
> +#ifdef CONFIG_MMU
>  /* check whether a pte points to a swap entry */
>  static inline int is_swap_pte(pte_t pte)
>  {
>  	return !pte_none(pte) && !pte_present(pte) && !pte_file(pte);
>  }
> +#endif
>  

Seems contradictory.  Is there _really_ a compilation error at present? 
The changelog seems to imply otherwise and no compiler error output is
quoted and it all compiled OK for me on nommu superh.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] stub out is_swap_pte for !MMU
  2008-02-08 22:05       ` Andrew Morton
@ 2008-02-08 22:19         ` Matt Mackall
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Mackall @ 2008-02-08 22:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: vapier, linux-kernel


On Fri, 2008-02-08 at 14:05 -0800, Andrew Morton wrote:
> On Fri, 08 Feb 2008 15:41:42 -0600
> Matt Mackall <mpm@selenic.com> wrote:
> 
> > Fix compile error on nommu for is_swap_pte
> > 
> > Does it ever make sense to ask "is this pte a swap entry?" on a machine
> > with no MMU? Presumably this also means it has no ptes too, right? In
> > which case, it's better to comment the whole function out. Then when
> > someone tries to ask the above meaningless question, they get a compile
> > error rather than a meaningless answer.
> > 
> > Signed-off-by: Matt Mackall <mpm@selenic.com>
> > 
> > diff -r 50a6e531a9f2 include/linux/swapops.h
> > --- a/include/linux/swapops.h	Mon Feb 04 20:23:02 2008 -0600
> > +++ b/include/linux/swapops.h	Fri Feb 08 15:38:01 2008 -0600
> > @@ -42,11 +42,13 @@
> >  	return entry.val & SWP_OFFSET_MASK(entry);
> >  }
> >  
> > +#ifdef CONFIG_MMU
> >  /* check whether a pte points to a swap entry */
> >  static inline int is_swap_pte(pte_t pte)
> >  {
> >  	return !pte_none(pte) && !pte_present(pte) && !pte_file(pte);
> >  }
> > +#endif
> >  
> 
> Seems contradictory.  Is there _really_ a compilation error at present? 
> The changelog seems to imply otherwise and no compiler error output is
> quoted and it all compiled OK for me on nommu superh.

Sorry, here's the compile error from the original thread (where the
original copy of the above patch was posted).

...
  CC      mm/vmscan.o
In file included from 
/home/bunk/linux/kernel-2.6/git/linux-2.6/mm/vmscan.c:44:
/home/bunk/linux/kernel-2.6/git/linux-2.6/include/linux/swapops.h: In function 'is_swap_pte':
/home/bunk/linux/kernel-2.6/git/linux-2.6/include/linux/swapops.h:48: error: implicit declaration of function 'pte_none'
/home/bunk/linux/kernel-2.6/git/linux-2.6/include/linux/swapops.h:48: error: implicit declaration of function 'pte_present'
make[2]: *** [mm/vmscan.o] Error 1

-- 
Mathematics is the supreme nostalgia of our time.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-08 22:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-08 20:02 [PATCH] stub out is_swap_pte for !MMU Mike Frysinger
2008-02-08 20:49 ` Matt Mackall
2008-02-08 21:25   ` Mike Frysinger
2008-02-08 21:41     ` Matt Mackall
2008-02-08 22:05       ` Andrew Morton
2008-02-08 22:19         ` Matt Mackall

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).