sculpt_manager: set affinity for child

With this commit it is possible to specify the affinity for components
directly managed by Sculpt, like drivers.
This commit is contained in:
Josef Söntgen 2024-11-05 16:44:45 +01:00 committed by Christian Helmuth
parent 0f70cbd704
commit f72fdf77ed
5 changed files with 21 additions and 0 deletions

View File

@ -65,6 +65,7 @@ struct Sculpt::Deploy
_child_states, { .name = "depot_rom",
.priority = Priority::STORAGE,
.cpu_quota = 0,
.location = { },
.initial = { Ram_quota{24*1024*1024}, Cap_quota{200} },
.max = { Ram_quota{2*1024*1024*1024UL}, { } } } };
@ -72,6 +73,7 @@ struct Sculpt::Deploy
_child_states, { .name = "dynamic_depot_rom",
.priority = Priority::STORAGE,
.cpu_quota = 0,
.location = { },
.initial = { Ram_quota{8*1024*1024}, Cap_quota{200} },
.max = { Ram_quota{2*1024*1024*1024UL}, { } } } };

View File

@ -169,6 +169,7 @@ struct Sculpt::Fb_driver : private Noncopyable
.name = "fb",
.priority = Priority::MULTIMEDIA,
.cpu_quota = 20,
.location = { },
.initial = { Ram_quota { 16*1024*1024 },
Cap_quota { 250 } },
.max = { } } );

View File

@ -51,6 +51,7 @@ struct Sculpt::Touch_driver : private Noncopyable
.name = "touch",
.priority = Priority::MULTIMEDIA,
.cpu_quota = 10,
.location = { },
.initial = { Ram_quota { 10*1024*1024 },
Cap_quota { 250 } },
.max = { } } );

View File

@ -36,6 +36,8 @@ struct Sculpt::Child_state : Noncopyable
Priority priority;
unsigned cpu_quota;
Affinity::Location location;
struct Initial { Ram_quota ram; Cap_quota caps; } initial;
struct Max { Ram_quota ram; Cap_quota caps; } max;
@ -64,6 +66,11 @@ struct Sculpt::Child_state : Noncopyable
Version _version { 0 };
static bool _location_valid(Attr const attr)
{
return attr.location.width() != 0 && attr.location.height() != 0;
}
public:
Child_state(Registry<Child_state> &registry, Attr const attr)
@ -75,6 +82,7 @@ struct Sculpt::Child_state : Noncopyable
Child_state(registry, { .name = name,
.priority = priority,
.cpu_quota = 0,
.location = { },
.initial = { initial_ram, initial_caps },
.max = { } })
{ }
@ -108,6 +116,14 @@ struct Sculpt::Child_state : Noncopyable
if (_attr.cpu_quota)
gen_named_node(xml, "resource", "CPU", [&] {
xml.attribute("quantum", _attr.cpu_quota); });
if (_location_valid(_attr))
xml.node("affinity", [&] {
xml.attribute("xpos", _attr.location.xpos());
xml.attribute("ypos", _attr.location.ypos());
xml.attribute("width", _attr.location.width());
xml.attribute("height", _attr.location.height());
});
}
/**

View File

@ -37,6 +37,7 @@ struct Sculpt::Ram_fs_state : Child_state, File_system
Child_state(registry, { .name = name,
.priority = Priority::LEITZENTRALE,
.cpu_quota = 0,
.location = { },
.initial = { Ram_quota{1024*1024}, Cap_quota{300} },
.max = { Ram_quota{2*1024*1024*1024UL}, { } } }),
File_system(File_system::UNKNOWN)