wendelin.core:90d32e51a11291095114f6a6c097c4bf843b7f27 commitshttps://lab.nexedi.com/kirr/wendelin.core/-/commits/90d32e51a11291095114f6a6c097c4bf843b7f272015-04-03T12:18:47+03:00https://lab.nexedi.com/kirr/wendelin.core/-/commit/90d32e51a11291095114f6a6c097c4bf843b7f27ZBigArray: in-ZODB stored BigArray2015-04-03T12:18:47+03:00Kirill Smelkovkirr@nexedi.com
This is like to BigArray, like ZBigFile is to BigFile (<a href="/klaus/wendelin.core/-/commit/4174b84aca87e9e67247eaf400f25be8e410d197" data-original="4174b84a" data-link="false" data-link-reference="false" data-project="849" data-commit="4174b84aca87e9e67247eaf400f25be8e410d197" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile: BigFile backend to store data in ZODB" class="gfm gfm-commit has-tooltip">4174b84a</a>
"bigfile: BigFile backend to store data in ZODB")https://lab.nexedi.com/kirr/wendelin.core/-/commit/0c826d5c7ed5196919656ac389b68f18974cd709BigArray: An ndarray-like on top of BigFile memory mappings2015-04-03T12:15:13+03:00Kirill Smelkovkirr@nexedi.com
I.e. something like numpy.memmap for numpy.ndarray and OS files. The whole
bigarray cannot be used as a drop-in replacement for numpy arrays, but BigArray
_slices_ are real ndarrays and can be used everywhere ndarray can be used,
including in C/Fortran code. Slice size is limited by mapping-size (=
address-space size) limit, i.e. to ~ max 127TB on Linux/amd64.
Changes to bigarray memory are changes to bigfile memory mapping and as such
can be discarded or saved back to bigfile using mapping (= BigFileH) dirty
discard/writeout interface.
For the same reason the whole amount of changes to memory is limited by amount
of physical RAM.https://lab.nexedi.com/kirr/wendelin.core/-/commit/4174b84aca87e9e67247eaf400f25be8e410d197bigfile: BigFile backend to store data in ZODB2015-04-03T12:08:47+03:00Kirill Smelkovkirr@nexedi.com
This adds transactionality and with e.g. NEO[1] allows to distribute
objects to nodes into cluster.
We hook into ZODB two-phase commit process as a separate data manager,
and synchronize changes to memory, to changes to object only at that
time.
Alternative would be to get notified on every page change, and mark
appropriate object as dirty right at that moment.
But I wanted to stay close to filesystem design (we don't get
notification for every file change from kernel) - that's why it is done
the first way.
[1] <a href="http://www.neoppod.org/" rel="nofollow noreferrer noopener" target="_blank">http://www.neoppod.org/</a>https://lab.nexedi.com/kirr/wendelin.core/-/commit/b3910de817890b6838d0bed2a511af43f59fff60bigfile: BackFile backend to store data in an OS file2015-04-03T12:01:25+03:00Kirill Smelkovkirr@nexedi.com
In Python. To demonstrate how backends could be implemented and test
system on simple things.https://lab.nexedi.com/kirr/wendelin.core/-/commit/35eb95c21f5c6421270cbbb30daa33bcdda5fe53bigfile: Python wrapper around virtual memory subsystem2015-04-03T12:00:09+03:00Kirill Smelkovkirr@nexedi.com
Exposes BigFile - this way users can define BigFile backend in Python.
Also exposed are BigFile handles, and VMA objects which are results of
mmaping.https://lab.nexedi.com/kirr/wendelin.core/-/commit/8ba39a60cf41b9e369c3c0d9a15197505390b22dPrepare to test python code with py.test2015-04-03T12:00:09+03:00Kirill Smelkovkirr@nexedi.com
We'll use py.test for unit-testing of Python part.https://lab.nexedi.com/kirr/wendelin.core/-/commit/9a293c2d0e87d35bcd826828720ac7c8ccb83a22bigfile/virtmem: Userspace Virtual Memory Manager2015-04-03T11:50:54+03:00Kirill Smelkovkirr@nexedi.com
Does similar things to what kernel does - users can mmap file parts into
address space and access them read/write. The manager will be getting
invoked by hardware/OS kernel for cases when there is no page loaded for
read, or when a previousle read-only page is being written to.
Additionally to features provided in kernel, it support to be used to
store back changes in transactional way (see fileh_dirty_writeout()) and
potentially use huge pages for mappings (though this is currently TODO)https://lab.nexedi.com/kirr/wendelin.core/-/commit/9065e2b9452432c13d609688671b45089c65d516bigfile/file.h: C interface for defining BigFile backends2015-04-03T11:50:54+03:00Kirill Smelkovkirr@nexedi.com
Users can inherit from BigFile and provide custom ->loadblk() and
->storeblk() to load/store file blocks from a database or some other
storage. The system then could use such files to memory map them into
user address space (see next patch).https://lab.nexedi.com/kirr/wendelin.core/-/commit/76d8f76dc16c866889ae81cf48f5bf4fced29e15Script to run compiled linux kernel with root fs mounted from host2015-04-03T11:35:23+03:00Kirill Smelkovkirr@nexedi.com
Useful to debug (via either printk or gdb) the kernel - one can boot it,
and tweak compile test program on host and be ready to test it inside
qemu on tested kernel. Another use case is to add tracing printk to
kernel and to boot it on each iteration. Booting via qemu means the
workflow is not disrupted as would with rebooting the hardware.
With this tool it was straightforward to find out why mmap-alias through
mremap does not work for huge pages:
static struct vm_area_struct *vma_to_resize(unsigned long addr,
unsigned long old_len, unsigned long new_len, unsigned long *p)
{
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma = find_vma(mm, addr);
if (!vma || vma->vm_start > addr)
goto Efault;
if (is_vm_hugetlb_page(vma)) <--
goto Einval;
mremap_to(...)
{
/* lots of checks, then */
vma_to_resize(...)https://lab.nexedi.com/kirr/wendelin.core/-/commit/8c935a5f7d5e1cdbd57f1a0168f6401407229cdfbigfile: RAM subsystem2015-04-03T11:34:21+03:00Kirill Smelkovkirr@nexedi.com
This thing allows to get aliasable RAM from OS kernel and to manage it.
Currently we get memory from a tmpfs mount, and hugetlbfs should also
work, but is TODO because hugetlbfs in the kernel needs to be improved.
We need aliasing because we'll need to be able to memory map the same
page into several places in address space, e.g. for taking two slices
overlapping slice of the same array at different times.
Comes with test programs that show we aliasing does not work for
anonymous memory.https://lab.nexedi.com/kirr/wendelin.core/-/commit/77d6153328ced76f8e3b91cde56fe33cd859a08abigfile: Stub for virtmem2015-04-03T11:33:21+03:00Kirill Smelkovkirr@nexedi.com
This will be the core of virtual memory subsystem. For now we just
define a structure to describe pages of memory and add utility to
allocate address space from OS.https://lab.nexedi.com/kirr/wendelin.core/-/commit/e8cea9338b0f85b2c186098809abff1f72a593bawendelin/list.h: include list.h from linux with needed headers pre-included2015-04-03T11:32:55+03:00Kirill Smelkovkirr@nexedi.comhttps://lab.nexedi.com/kirr/wendelin.core/-/commit/6f7d4d645d9a59f4accedee58567c3f7847be6bcLow-level pagefault handler2015-04-03T11:07:24+03:00Kirill Smelkovkirr@nexedi.com
We hook into SIGSEGV and handle read/write pagefaults this way.
In this patch there goes stub code that only detects faults and
determines (in arch specific way) whether fault was for read or write
and there is a TODO to pass that information to higher level.
It also comes with tests to detect we still crash if we access something
incorrectly, so people could have coredumps and investigate them.https://lab.nexedi.com/kirr/wendelin.core/-/commit/45af76e6bc622952b4987cff4f63bc32559ec6bdbigfile/pagemap: specialized {} uint64 -> void * mapping2015-04-03T10:55:31+03:00Kirill Smelkovkirr@nexedi.com
For BigFiles we'll needs to maintain `{} offset-in-file -> void *` mapping. A
hash or a binary tree could be used there, but since we know files are
most of the time accessed sequentially and locally in pages-batches, we
can also organize the mapping in batches of keys.
Specifically offset bits are so divided into parts, that every part
addresses 1 entry in a table of hardware-page in size. To get to the actual
value, the system lookups first table by first part of offset, then from
first table and next part from address - second table, etc.
To clients this looks like a dictionary with get/set/del & clear methods,
but lookups are O(1) time always, and in contrast to hashes values are
stored with locality (= adjacent lookups almost always access the same tables).https://lab.nexedi.com/kirr/wendelin.core/-/commit/8114ad6c0be7140983966beaa027e44a9cba84edbigfile/types.h: Type's we'll use2015-04-03T10:54:11+03:00Kirill Smelkovkirr@nexedi.comhttps://lab.nexedi.com/kirr/wendelin.core/-/commit/cd5646af6de1b22302dff0aaf5e398ae88d45d91Prepare to unit-test C stuff2015-04-03T10:45:19+03:00Kirill Smelkovkirr@nexedi.com
We'll be testing C code in a similiar-to-python way - keep test_*.c
files nearby and compile/executing them as needed.
Tests are run several times in several ways - as plainly compiled and
also with additional error checkers:
- AddressSanitizer
- ThreadSanitizer
- and similiar checkers from Valgrindhttps://lab.nexedi.com/kirr/wendelin.core/-/commit/699b13752282f461e381e52be854766a6641ebeclib/mem: Python utilities to zero, set & copy memory2015-04-03T10:35:59+03:00Kirill Smelkovkirr@nexedi.com
Like C bzero / memset & memcopy - but work on python buffers. We
leverage NumPy for doing actual work, and this way NumPy becomes a
depenency.
Having NumPy as a dependency is ok - we'll for sure need it later as we
are trying to build out-of-core ndarrays.https://lab.nexedi.com/kirr/wendelin.core/-/commit/3e5e78cdcedced3a5f860861597072506a1499c0lib/utils: Small C utilities we'll use2015-04-03T10:34:26+03:00Kirill Smelkovkirr@nexedi.com
Like taking an exact integer log2, upcasting pointers for C-style
inheritance done in a Plan9 way, and wrappers to functions which should
never fail.https://lab.nexedi.com/kirr/wendelin.core/-/commit/db28e53f87af267f85b07d39a35dd829c1b9f3c4lib/bug: Small utilities to say there is a warning, or a todo, or a bug on co...2015-04-03T10:34:02+03:00Kirill Smelkovkirr@nexedi.com
Modelled by ones used in Linux kernel.https://lab.nexedi.com/kirr/wendelin.core/-/commit/5755a6b311727469b54260ddc66eb50a52b68ffeBasic setup.py / Makefile to build/install/sdist stuff + bigfile.so skeleton2015-04-03T10:26:39+03:00Kirill Smelkovkirr@nexedi.com
It is an early project decision to use gnu99 & Plan9 C extensions, to
simplify C code.
So far we only build stub wendelin/bigfile/_bigfile.so .
Makefile is introduced because there will be targets which are easier to
handle at make level. For end users no make knowledge is required -
usual `python setup.py build|install|...` work, redirecting to make
where necessary.
As was promised (<a href="/kirr/wendelin.core/-/commit/e870781d4c030e2eb7022ee72d57985697d34fb4" data-original="e870781d" data-link="false" data-link-reference="false" data-project="20" data-commit="e870781d4c030e2eb7022ee72d57985697d34fb4" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="Top-level in-tree import redirector" class="gfm gfm-commit has-tooltip">e870781d</a> "Top-level in-tree import redirector")
setup.py contains install-time hooks to handle in-tree wendelin.py and
install it as a module namespace.
For sdist, we just use `git ls-files` info if we are in a checkout.https://lab.nexedi.com/kirr/wendelin.core/-/commit/0b7b5f6a53fd014c1f4164925a4eb4da15e10734Basic .gitignore2015-04-03T10:26:39+03:00Kirill Smelkovkirr@nexedi.com
Prepare for building stuff and add commonly produced files to our
.gitignore .https://lab.nexedi.com/kirr/wendelin.core/-/commit/1e92c92175a51fafc5ed5984bcfea4e39db8263eStart wendelin.bigfile module2015-04-03T10:11:54+03:00Kirill Smelkovkirr@nexedi.com
This will be a module to allow users to program custom file-like
backends and latter memory-map content of files from the backend.
For now just start the module structure.https://lab.nexedi.com/kirr/wendelin.core/-/commit/a0f940ad16ccadd036ff1c9080fd9dcbd84c3c6dHook in list.h from Linux2015-04-03T09:52:54+03:00Kirill Smelkovkirr@nexedi.com
Unfortunately in CCAN they made separation of list_head into list_head &
list_node (for better type safety I suppose), but that leads e.g. to
inablility to insert element in the middle of the list.
We take the code from util-linux.git (v2.25-165-g9138d6f)[1] which claims
LGPL license for it, with which we are fine.
[1] <a href="https://git.kernel.org/cgit/utils/util-linux/util-linux.git/tree/include/list.h?id=v2.25-165-g9138d6f" rel="nofollow noreferrer noopener" target="_blank">https://git.kernel.org/cgit/utils/util-linux/util-linux.git/tree/include/list.h?id=v2.25-165-g9138d6f</a>https://lab.nexedi.com/kirr/wendelin.core/-/commit/ea890863a77fe08832ad697c046feaa98497bb42Hook in CCAN2015-04-03T09:46:47+03:00Kirill Smelkovkirr@nexedi.com
CCAN[1] is a "Comprehensive C Archive Network" - a collection of useful
C libraries to use.
Wendelin.core will be a C project in big part, so having CCAN at hand is
useful.
We hook CCAN as git submodule, without copying it into git repo. Later
on making source tarball distribution, the code will be injected into
generated tarball, so there will be no additional dependencies to
download something from network for end users.
[1] <a href="http://ccodearchive.net/" rel="nofollow noreferrer noopener" target="_blank">http://ccodearchive.net/</a>https://lab.nexedi.com/kirr/wendelin.core/-/commit/e870781d4c030e2eb7022ee72d57985697d34fb4Top-level in-tree import redirector2015-04-03T09:40:37+03:00Kirill Smelkovkirr@nexedi.com
For working copy checkout we would like to work on the source
right-away, without putting it under additional wendelin/ (and possibly
/core/) subdirectories.
Add in-tree modules redirector which tweaks plain-python and
pkg_resources-based imports so that e.g.
import wendelin.bigarray
while in-tree resolves to
bigarray/__init__.py
In installed state, there will be no such redirector, and code will be
installed with conventional structure.https://lab.nexedi.com/kirr/wendelin.core/-/commit/66c976edd03b4105d58743ae0a29e48cfa756ec7Licensing2015-04-03T09:35:55+03:00Kirill Smelkovkirr@nexedi.com
As a first step we want to make sure the code can be used by open-source
projects without a problem.
So GPLv3+ with wide exception for all open-source licenses.https://lab.nexedi.com/kirr/wendelin.core/-/commit/f155a6d62d44904dac083710d726faa9bd3ee264Start of wendelin.core.git2015-04-03T09:27:49+03:00Kirill Smelkovkirr@nexedi.com
The project to implement Out-of-core NumPy arrays in backward-compatible
way.