* Variable PTE_FILE_MAX_BITS
@ 2003-04-09 5:16 Pete Zaitcev
2003-04-09 5:55 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Pete Zaitcev @ 2003-04-09 5:16 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Andrew,
would you be so kind to take this and forward to Linus?
I think this segment of the code is your brainchild.
On sparc, the PTE_FILE_MAX_BITS is variable (Worse, actually...
we change all occurences in kernel text segment to correct value
at boot time.) This should not harm other arches, because
gcc is capable to optimize constant conditions.
-- Pete
--- linux-2.5.66-bk11/mm/fremap.c 2003-04-05 13:26:24.000000000 -0800
+++ linux-2.5.66-bk11-sparc/mm/fremap.c 2003-04-05 13:28:22.000000000 -0800
@@ -136,10 +136,10 @@
return err;
/* Can we represent this offset inside this architecture's pte's? */
-#if PTE_FILE_MAX_BITS < BITS_PER_LONG
- if (pgoff + (size >> PAGE_SHIFT) >= (1UL << PTE_FILE_MAX_BITS))
- return err;
-#endif
+ /* This needs to be evaluated at runtime on some platforms */
+ if (PTE_FILE_MAX_BITS < BITS_PER_LONG)
+ if (pgoff + (size >> PAGE_SHIFT) >= (1UL << PTE_FILE_MAX_BITS))
+ return err;
down_read(&mm->mmap_sem);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Variable PTE_FILE_MAX_BITS
2003-04-09 5:16 Variable PTE_FILE_MAX_BITS Pete Zaitcev
@ 2003-04-09 5:55 ` Andrew Morton
2003-04-09 6:19 ` Pete Zaitcev
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2003-04-09 5:55 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: linux-kernel
Pete Zaitcev <zaitcev@redhat.com> wrote:
>
> Andrew,
>
> would you be so kind to take this and forward to Linus?
> I think this segment of the code is your brainchild.
y'know, as I was writing that code I thought "no architecture could be dumb
enough to make PTE_FILE_MAX_BITS variable".
> On sparc
Ah. That architecture.
>
> --- linux-2.5.66-bk11/mm/fremap.c 2003-04-05 13:26:24.000000000 -0800
> +++ linux-2.5.66-bk11-sparc/mm/fremap.c 2003-04-05 13:28:22.000000000 -0800
> @@ -136,10 +136,10 @@
> return err;
>
> /* Can we represent this offset inside this architecture's pte's? */
> -#if PTE_FILE_MAX_BITS < BITS_PER_LONG
> - if (pgoff + (size >> PAGE_SHIFT) >= (1UL << PTE_FILE_MAX_BITS))
> - return err;
> -#endif
> + /* This needs to be evaluated at runtime on some platforms */
> + if (PTE_FILE_MAX_BITS < BITS_PER_LONG)
> + if (pgoff + (size >> PAGE_SHIFT) >= (1UL << PTE_FILE_MAX_BITS))
> + return err;
>
The reason I didn't do this in the first place is that if PTE_FILE_MAX_BITS
is 32 (as it is for ia32 PAE), the compiler generates a warning about the
(1<<32). I guess it generates a bug, too.
Ho hum. I shall make it "1ULL".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Variable PTE_FILE_MAX_BITS
2003-04-09 5:55 ` Andrew Morton
@ 2003-04-09 6:19 ` Pete Zaitcev
0 siblings, 0 replies; 3+ messages in thread
From: Pete Zaitcev @ 2003-04-09 6:19 UTC (permalink / raw)
To: Andrew Morton; +Cc: Pete Zaitcev, linux-kernel
> > would you be so kind to take this and forward to Linus?
> > I think this segment of the code is your brainchild.
>
> y'know, as I was writing that code I thought "no architecture could be dumb
> enough to make PTE_FILE_MAX_BITS variable".
Two different PTE formats.
> > + /* This needs to be evaluated at runtime on some platforms */
> > + if (PTE_FILE_MAX_BITS < BITS_PER_LONG)
> > + if (pgoff + (size >> PAGE_SHIFT) >= (1UL << PTE_FILE_MAX_BITS))
> > + return err;
>
> The reason I didn't do this in the first place is that if PTE_FILE_MAX_BITS
> is 32 (as it is for ia32 PAE), the compiler generates a warning about the
> (1<<32). I guess it generates a bug, too.
>
> Ho hum. I shall make it "1ULL".
Wait, that would be a pessimization. Let me think about it.
I am thinking that perhaps I can arrange is so that the number
bits on different sparcs would end the same.
-- Pete
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-09 6:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-09 5:16 Variable PTE_FILE_MAX_BITS Pete Zaitcev
2003-04-09 5:55 ` Andrew Morton
2003-04-09 6:19 ` Pete Zaitcev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox