David Brown
2007-Mar-05 18:40 UTC
[Lustre-discuss] PAGE_SIZE usage in lustre and a debian fix.
Okay PAGE_SIZE and friends isn''t available for some arches in the kernel, in fact the only architectures that PAGE_SIZE and friends are available for code that isn''t compiled with __KERNEL__ are i386, m32r, ppc, s390, sh64, x86_64, so after trying to compile the debian packages (which build the userspace components separate from the kernel components) on ia64 it failed. Attached is a patch to ''fix'' the problem the first part of the patch is what should be happening. The second part of the patch is a hack to get the source to build for debian built ia64 kernels.>From comments on the LKML PAGE_SIZE shouldn''t ever be used byuserspace and should be using getpagesize() and perform some functions to get the other values (PAGE_MASK and PAGE_SHIFT). Hopefully this helps, - David Brown -------------- next part -------------- A non-text attachment was scrubbed... Name: ia64-page-size-fixes.patch Type: text/x-patch Size: 1084 bytes Desc: not available Url : http://mail.clusterfs.com/pipermail/lustre-discuss/attachments/20070305/5d193ddf/ia64-page-size-fixes.bin
Andreas Dilger
2007-Mar-08 11:33 UTC
[Lustre-discuss] PAGE_SIZE usage in lustre and a debian fix.
On Mar 05, 2007 17:40 -0800, David Brown wrote:> Okay PAGE_SIZE and friends isn''t available for some arches in the > kernel, in fact the only architectures that PAGE_SIZE and friends are > available for code that isn''t compiled with __KERNEL__ are i386, m32r, > ppc, s390, sh64, x86_64, so after trying to compile the debian > packages (which build the userspace components separate from the > kernel components) on ia64 it failed. > > Attached is a patch to ''fix'' the problem the first part of the patch > is what should be happening. The second part of the patch is a hack to > get the source to build for debian built ia64 kernels. > > >From comments on the LKML PAGE_SIZE shouldn''t ever be used by > userspace and should be using getpagesize() and perform some functions > to get the other values (PAGE_MASK and PAGE_SHIFT).I''m not sure that liblustre has ever been tested on ia64, though of course it is entirely possible that it works OK. The value of PAGE_SIZE used by liblustre is pretty arbitrary I think, a large part of it is just so that the same code can be used by liblustre and linux. As for your patch, I haven''t looked at it closely, but I''m confused why you would change PAGE_SIZE -> getpagesize(), and then later make a #define PAGE_SIZE? Also, there is no guarantee that the ia64 PAGE_SIZE is 2^14, though whether liblustre really cares is another matter. Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc.
David Brown
2007-Mar-08 14:34 UTC
[Lustre-discuss] PAGE_SIZE usage in lustre and a debian fix.
> I''m not sure that liblustre has ever been tested on ia64, though of course > it is entirely possible that it works OK. The value of PAGE_SIZE used by > liblustre is pretty arbitrary I think, a large part of it is just so that > the same code can be used by liblustre and linux. > > As for your patch, I haven''t looked at it closely, but I''m confused why > you would change PAGE_SIZE -> getpagesize(), and then later make a > #define PAGE_SIZE? Also, there is no guarantee that the ia64 PAGE_SIZE > is 2^14, though whether liblustre really cares is another matter.I''ve been having an on going conversation on lkml about it and they really say, "use getpagesize()" but lustre uses PAGE_MASK PAGE_SHIFT and all the other defines in your userspace code as well. So the first part of the patch is what should be happening and the second part is fast hack to get it to build with a ''safe'' value for the page size. Really the correct fix would be to obtain the value of PAGE_SIZE via getpagesize() then create some functions to get PAGE_MASK and PAGE_SHIFT from the value returned by getpagesize(). At least that''s what I''d do... Thanks, - David Brown
Andreas Dilger
2007-Mar-09 05:08 UTC
[Lustre-discuss] PAGE_SIZE usage in lustre and a debian fix.
On Mar 08, 2007 13:34 -0800, David Brown wrote:> I''ve been having an on going conversation on lkml about it and they > really say, "use getpagesize()" but lustre uses PAGE_MASK PAGE_SHIFT > and all the other defines in your userspace code as well. So the first > part of the patch is what should be happening and the second part is > fast hack to get it to build with a ''safe'' value for the page size. > Really the correct fix would be to obtain the value of PAGE_SIZE via > getpagesize() then create some functions to get PAGE_MASK and > PAGE_SHIFT from the value returned by getpagesize(). At least that''s > what I''d do...My point is that because liblustre is really a user-space application, it doesn''t care so much what value is used for PAGE_SIZE. I suspect (though I haven''t really done an in-depth analysis) that you could set PAGE_SIZE to some arbitrary power-of-two multiple of 4096 and not have any problems at all. The PAGE_SIZE define IS used in the code that is shared between liblustre and the linux client filesystem code (llite) but those are used in completely disjoint settings. The only thing that matters is that the liblustre build environment supply SOME sensible value for PAGE_SIZE & friends so that the shared code will compile. Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc.