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
a269fb42
Unverified
Commit
a269fb42
authored
Oct 27, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Regionlist overhaul: Refactor regionlist cram calculation
parent
47ae3641
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
13 deletions
+29
-13
fellow_regionlist.h
src/fellow_regionlist.h
+29
-13
No files found.
src/fellow_regionlist.h
View file @
a269fb42
...
...
@@ -103,29 +103,45 @@ do { \
regionlist_onlystk_add(name, o, s); \
} while(0)
static
struct
regl
*
regl_alloc_bits
(
buddy_t
*
membuddy
,
const
uint8_t
bits
,
int8_t
cram
,
struct
regionlist
**
rlp
)
static
uint8_t
regl_minbits
;
static
void
__attribute__
((
constructor
))
init_regl
(
void
)
{
struct
buddy_ptr_page
alloc
;
struct
regionlist
*
rl
;
struct
regl
*
r
;
int8_t
c
;
size_t
sz
,
b
;
unsigned
b
=
log2up
(
2
*
sizeof
(
struct
regl
)
+
sizeof
(
struct
regionlist
));
assert
(
b
<=
UINT8_MAX
);
regl_minbits
=
(
typeof
(
regl_minbits
))
b
;
}
sz
=
2
*
sizeof
*
r
+
sizeof
*
rl
;
b
=
log2up
(
sz
);
assert
(
bits
>=
b
);
static
int8_t
regl_cram
(
const
uint8_t
bits
,
int8_t
cram
)
{
int8_t
c
;
assert
(
bits
>
regl_minbits
);
// should we also support negative cram?
assert
(
cram
>=
0
);
assert
(
bits
<
INT8_MAX
);
c
=
(
int8_t
)(
bits
-
(
typeof
(
bits
))
b
);
c
=
(
int8_t
)(
bits
-
regl_minbits
);
assert
(
c
>=
0
);
if
(
cram
>
c
)
cram
=
c
;
alloc
=
buddy_alloc1_ptr_page_wait
(
membuddy
,
FEP_MEM_FREE
,
bits
,
cram
);
return
(
cram
);
}
static
struct
regl
*
regl_alloc_bits
(
buddy_t
*
membuddy
,
const
uint8_t
bits
,
int8_t
cram
,
struct
regionlist
**
rlp
)
{
struct
buddy_ptr_page
alloc
;
struct
regionlist
*
rl
;
struct
regl
*
r
;
size_t
sz
,
b
;
alloc
=
buddy_alloc1_ptr_page_wait
(
membuddy
,
FEP_MEM_FREE
,
bits
,
regl_cram
(
bits
,
cram
));
AN
(
alloc
.
ptr
);
sz
=
(
size_t
)
1
<<
alloc
.
bits
;
...
...
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