Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
877bab37
Commit
877bab37
authored
Jul 11, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
badfddf3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
bigfile/_bigfile.c
bigfile/_bigfile.c
+9
-9
bigfile/virtmem.c
bigfile/virtmem.c
+5
-5
No files found.
bigfile/_bigfile.c
View file @
877bab37
...
...
@@ -50,7 +50,7 @@ static PyObject *pybuf_str;
/* whether to pass old buffer instead of memoryview to .loadblk() / .storeblk()
*
* on python2 < 2.7.10 memor
e
view object is not accepted in a lot of
* on python2 < 2.7.10 memor
y
view object is not accepted in a lot of
* places, see e.g. http://bugs.python.org/issue22113 for struct.pack_into()
*
* also on python 2.7.10, even latest numpy does not accept memoryview as
...
...
@@ -171,7 +171,7 @@ void XPyObject_PrintReferrers(PyObject *obj, FILE *fp);
static
int
XPyFrame_IsCalleeOf
(
PyFrameObject
*
f
,
PyFrameObject
*
top
);
/* buffer utilities: unpin buffer from its memory - make it zero-length
* pointing to NULL but staying a va
i
lid python object */
* pointing to NULL but staying a valid python object */
#if PY_MAJOR_VERSION < 3
void
XPyBufferObject_Unpin
(
PyBufferObject
*
bufo
);
#endif
...
...
@@ -348,7 +348,7 @@ static /*const*/ PyMethodDef pyvma_methods[] = {
{
NULL
}
};
// XXX vvv better switch on various possibilities and find approp
t
iate type
// XXX vvv better switch on various possibilities and find approp
r
iate type
// (e.g. on X32 uintptr_t will be 4 while long will be 8)
const
int
_
=
BUILD_ASSERT_OR_ZERO
(
sizeof
(
uintptr_t
)
==
sizeof
(
unsigned
long
));
...
...
@@ -458,7 +458,7 @@ PyFunc(pyfileh_isdirty, "isdirty() - are there any changes to fileh memory at al
if
(
!
PyArg_ParseTuple
(
args
,
""
))
return
NULL
;
/* NOTE not strictly nec
c
essary to virt_lock() for checking ->dirty_pages not empty */
/* NOTE not strictly necessary to virt_lock() for checking ->dirty_pages not empty */
return
PyBool_FromLong
(
!
list_empty
(
&
pyfileh
->
dirty_pages
));
}
...
...
@@ -570,14 +570,14 @@ static int pybigfile_loadblk(BigFile *file, blk_t blk, void *buf)
* as the result - _we_ are the thread which holds the GIL and can call
* python capi. */
// XXX assert PyGILState_GetThisThreadState() != NULL
// (i.e. pyton already knows this thread?)
// (i.e. pyt
h
on already knows this thread?)
gstate
=
PyGILState_Ensure
();
/* TODO write why we setup completly new thread state which looks like
/* TODO write why we setup complet
e
ly new thread state which looks like
* switching threads for python but stays at the same OS thread
*
* a) do not change current thread state in any way;
* b) to completly clear ts after loadblk (ex. for pybuf->refcnf to go to exactly 1)
* b) to complet
e
ly clear ts after loadblk (ex. for pybuf->refcnf to go to exactly 1)
*/
/* in python thread state - save what we'll possibly override
...
...
@@ -690,13 +690,13 @@ out:
* come here with gc.collecting=1
*
* NOTE also: while collecting garbage even more garbage can be
* created due to arbitrary code run from unde
l
__del__ of released
* created due to arbitrary code run from unde
r
__del__ of released
* objects and weakref callbacks. This way after here GC collect
* even a single allocation could trigger GC, and thus arbitrary
* python code run, again */
PyGC_Collect
();
/* garbage collection could result in running arbitra
t
y code
/* garbage collection could result in running arbitra
r
y code
* because of finalizers. Print problems (if any) and make sure
* once again exception state is clear */
if
(
PyErr_Occurred
())
...
...
bigfile/virtmem.c
View file @
877bab37
...
...
@@ -59,7 +59,7 @@ static int __ram_reclaim(RAM *ram);
/* global lock which protects manipulating virtmem data structures
*
* NOTE not scalable, but this is temporary solution - as we are going to move
* memory managment back into the kernel, where it is done properly. */
* memory manag
e
ment back into the kernel, where it is done properly. */
static
pthread_mutex_t
virtmem_lock
=
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
;
static
const
VirtGilHooks
*
virtmem_gilhooks
;
...
...
@@ -243,7 +243,7 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
if
(
!
vma
->
page_ismappedv
)
goto
fail
;
// XXX hardcoded - allow user choi
s
e?
// XXX hardcoded - allow user choi
c
e?
vma
->
mmap_overlay
=
(
fops
->
mmap_setup_read
!=
NULL
);
if
(
vma
->
mmap_overlay
)
{
...
...
@@ -790,7 +790,7 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
/* (5b) page is currently being loaded by another thread - wait for load to complete
*
* NOTE a page is protected from being concurently loaded by two threads at
* NOTE a page is protected from being concur
r
ently loaded by two threads at
* the same time via:
*
* - virtmem lock - we get/put pages from fileh->pagemap only under it
...
...
@@ -805,7 +805,7 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
void
*
gilstate
;
virt_unlock
();
gilstate
=
virt_gil_ensure_unlocked
();
usleep
(
10000
);
// XXX with 1000 usle
p
p still busywaits
usleep
(
10000
);
// XXX with 1000 usle
e
p still busywaits
virt_gil_retake_if_waslocked
(
gilstate
);
virt_lock
();
return
VM_RETRY
;
...
...
@@ -940,7 +940,7 @@ void page_decref(Page *page)
void
*
page_mmap
(
Page
*
page
,
void
*
addr
,
int
prot
)
{
RAMH
*
ramh
=
page
->
ramh
;
// XXX better call ramh_mmap_page() without tinkering wih ramh_ops?
// XXX better call ramh_mmap_page() without tinkering wi
t
h ramh_ops?
return
ramh
->
ramh_ops
->
mmap_page
(
ramh
,
page
->
ramh_pgoffset
,
addr
,
prot
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment