[KDE/Mac] system misses support for posix_fallocate()

Michael Pyne mpyne at kde.org
Fri Sep 2 15:31:45 UTC 2011


On Friday, September 02, 2011 08:44:53 Bjoern Ricks wrote:
> Hi
> 
> I didn't know the code but I suppose this is only a warning. posix_fallocate
> allocates bytes from the file system. If the function is not available
> KSharedDataCache can't ensure that enough file system space is available
> and therefore it raises this message. But that is only a guess without
> looking at the actual code.

Yes, it is my way of trying to fail fast if there's not enough space available 
on the partition to allow mapping for a given-sized block of shared memory 
(required for the operation of KSharedDataCache).

Unfortunately if there isn't enough space so OS'es will allow the ftruncate(2) 
call to pass (as the data not filled in is stored in a very space-efficient 
manner), but when KSharedDataCache later references a memory page that would 
require a disk block, and that disk block is not available, there's nothing 
for the OS to do except immediately crash the application.

It's a very hard issue to preemptively defend against without a bit of OS 
help. There are ways to indirectly force the OS to commit every page to disk, 
but that can only be done on initial cache creation which is why I rely only 
on posix_fallocate at this point.

Another option I'll look at someday is to see if it's possible to use POSIX 
shm to have non-disk-backed caches available as an option (some namespace is 
still required, anonymous shm does not work for the KSharedDataCache use-
case).

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-mac/attachments/20110902/fd373d62/attachment.sig>


More information about the kde-mac mailing list