Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
slash
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
slash
Commits
ae7ba893
Unverified
Commit
ae7ba893
authored
Jan 17, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fellow_cache_obj: Make fco mem an extent to enable trimming
parent
0767fa84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
fellow_cache.c
src/fellow_cache.c
+9
-11
No files found.
src/fellow_cache.c
View file @
ae7ba893
...
@@ -626,7 +626,7 @@ struct fellow_cache_obj {
...
@@ -626,7 +626,7 @@ struct fellow_cache_obj {
struct
fellow_cache_lru
*
lru
;
struct
fellow_cache_lru
*
lru
;
uint64_t
ntouched
;
uint64_t
ntouched
;
struct
buddy_ptr_
page
fco_mem
;
// nil == embedded
struct
buddy_ptr_
extent
fco_mem
;
struct
buddy_ptr_page
fco_dowry
;
struct
buddy_ptr_page
fco_dowry
;
pthread_mutex_t
mtx
;
pthread_mutex_t
mtx
;
...
@@ -1544,7 +1544,7 @@ fellow_cache_obj_free(const struct fellow_cache *fc,
...
@@ -1544,7 +1544,7 @@ fellow_cache_obj_free(const struct fellow_cache *fc,
{
{
struct
fellow_cache_obj
*
fco
;
struct
fellow_cache_obj
*
fco
;
struct
fellow_cache_seg
*
fcs
;
struct
fellow_cache_seg
*
fcs
;
struct
buddy_ptr_
page
mem
;
struct
buddy_ptr_
extent
mem
;
TAKE_OBJ_NOTNULL
(
fco
,
fcop
,
FELLOW_CACHE_OBJ_MAGIC
);
TAKE_OBJ_NOTNULL
(
fco
,
fcop
,
FELLOW_CACHE_OBJ_MAGIC
);
...
@@ -1577,10 +1577,8 @@ fellow_cache_obj_free(const struct fellow_cache *fc,
...
@@ -1577,10 +1577,8 @@ fellow_cache_obj_free(const struct fellow_cache *fc,
if
(
fco
->
fco_dowry
.
bits
)
if
(
fco
->
fco_dowry
.
bits
)
buddy_return1_ptr_page
(
fc
->
membuddy
,
&
fco
->
fco_dowry
);
buddy_return1_ptr_page
(
fc
->
membuddy
,
&
fco
->
fco_dowry
);
TAKE
(
mem
,
fco
->
fco_mem
);
TAKE
(
mem
,
fco
->
fco_mem
);
if
(
mem
.
bits
)
{
assert
(
mem
.
ptr
==
fco
);
assert
(
mem
.
ptr
==
fco
);
buddy_return1_ptr_extent
(
fc
->
membuddy
,
&
mem
);
buddy_return1_ptr_page
(
fc
->
membuddy
,
&
mem
);
}
}
}
/*
/*
...
@@ -1954,7 +1952,7 @@ fellow_cache_obj_new(
...
@@ -1954,7 +1952,7 @@ fellow_cache_obj_new(
struct
fellow_cache_res
fcr
;
struct
fellow_cache_res
fcr
;
struct
fellow_cache_seg
*
fcs
;
struct
fellow_cache_seg
*
fcs
;
struct
buddy_reqs
*
reqs
;
struct
buddy_reqs
*
reqs
;
struct
buddy_ptr_
page
fco_mem
=
buddy_ptr_page
_nil
;
struct
buddy_ptr_
extent
fco_mem
=
buddy_ptr_extent
_nil
;
struct
buddy_ptr_extent
fdo_mem
=
buddy_ptr_extent_nil
;
struct
buddy_ptr_extent
fdo_mem
=
buddy_ptr_extent_nil
;
size_t
asz
,
mem_sz
,
ssz
;
size_t
asz
,
mem_sz
,
ssz
;
unsigned
u
;
unsigned
u
;
...
@@ -1972,7 +1970,7 @@ fellow_cache_obj_new(
...
@@ -1972,7 +1970,7 @@ fellow_cache_obj_new(
nseg_guess
=
1
;
nseg_guess
=
1
;
}
}
mem_sz
=
sizeof
*
fco
+
nseg_guess
*
sizeof
*
fcs
;
mem_sz
=
(
size_t
)
1
<<
log2up
(
sizeof
*
fco
+
nseg_guess
*
sizeof
*
fcs
)
;
asz
=
(
size_t
)
1
<<
log2up
(
dsk_sz
);
asz
=
(
size_t
)
1
<<
log2up
(
dsk_sz
);
// dowry is largest, so we allocate it first
// dowry is largest, so we allocate it first
...
@@ -1982,7 +1980,7 @@ fellow_cache_obj_new(
...
@@ -1982,7 +1980,7 @@ fellow_cache_obj_new(
AN
(
buddy_req_page
(
reqs
,
fc
->
tune
->
chunk_exponent
,
0
));
AN
(
buddy_req_page
(
reqs
,
fc
->
tune
->
chunk_exponent
,
0
));
if
(
fbo_mem
!=
NULL
)
if
(
fbo_mem
!=
NULL
)
AN
(
buddy_req_extent
(
reqs
,
sizeof
(
struct
fellow_busy
),
0
));
AN
(
buddy_req_extent
(
reqs
,
sizeof
(
struct
fellow_busy
),
0
));
AN
(
buddy_req_
page
(
reqs
,
log2up
(
mem_sz
)
,
0
));
AN
(
buddy_req_
extent
(
reqs
,
mem_sz
,
0
));
AN
(
buddy_req_extent
(
reqs
,
asz
,
0
));
AN
(
buddy_req_extent
(
reqs
,
asz
,
0
));
u
=
buddy_alloc_wait
(
reqs
);
u
=
buddy_alloc_wait
(
reqs
);
...
@@ -1999,7 +1997,7 @@ fellow_cache_obj_new(
...
@@ -1999,7 +1997,7 @@ fellow_cache_obj_new(
if
(
fbo_mem
!=
NULL
)
if
(
fbo_mem
!=
NULL
)
*
fbo_mem
=
buddy_get_next_ptr_extent
(
reqs
);
*
fbo_mem
=
buddy_get_next_ptr_extent
(
reqs
);
fco_mem
=
buddy_get_next_ptr_
page
(
reqs
);
fco_mem
=
buddy_get_next_ptr_
extent
(
reqs
);
fdo_mem
=
buddy_get_next_ptr_extent
(
reqs
);
fdo_mem
=
buddy_get_next_ptr_extent
(
reqs
);
buddy_alloc_wait_done
(
reqs
);
buddy_alloc_wait_done
(
reqs
);
...
@@ -2018,7 +2016,7 @@ fellow_cache_obj_new(
...
@@ -2018,7 +2016,7 @@ fellow_cache_obj_new(
AZ
(
pthread_mutex_init
(
&
fco
->
mtx
,
&
fc_mtxattr_errorcheck
));
AZ
(
pthread_mutex_init
(
&
fco
->
mtx
,
&
fc_mtxattr_errorcheck
));
AZ
(
pthread_cond_init
(
&
fco
->
cond
,
NULL
));
AZ
(
pthread_cond_init
(
&
fco
->
cond
,
NULL
));
ssz
=
((
size_t
)
1
<<
fco_mem
.
bits
)
-
sizeof
*
fco
;
ssz
=
fco_mem
.
size
-
sizeof
*
fco
;
(
void
)
fellow_cache_seglist_init
(
&
fco
->
seglist
,
ssz
,
fco
);
(
void
)
fellow_cache_seglist_init
(
&
fco
->
seglist
,
ssz
,
fco
);
...
...
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