Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic replication to kernel NR #338

Closed
wants to merge 6 commits into from

Conversation

gz
Copy link
Collaborator

@gz gz commented Sep 25, 2023

No description provided.

@vmwclabot
Copy link

@gz, you must sign our contributor license agreement before your changes are merged. Click here to sign the agreement. If you are a VMware employee, read this for further instruction.

@gz gz requested a review from hunhoffe September 25, 2023 16:10
Copy link
Collaborator

@hunhoffe hunhoffe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left a few comments - most of them minor, and the few that aren't may be due to my own misunderstanding.

use crate::nrproc::NrProcess;
use crate::process::MAX_PROCESSES;

/// Types of shared structures the client can request
#[derive(Debug, Eq, PartialEq, PartialOrd, Clone, Copy)]
#[repr(u8)]
pub enum ShmemStructure {
// TODO(dynrep): remove NrProcLogs/NrLog add NodeReplicated<Process> and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this comment?

@@ -67,7 +67,6 @@ pub(crate) fn schedule() -> ! {
// There is no process but we're the "main" thread,
// aggressively try and advance the replica
let start = rawtime::Instant::now();
crate::nrproc::advance_all();
crate::arch::advance_fs_replica();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now cnrfs isn't using dynamic replication, yes? Is that why advance_fs_replica() remains?

If so, I think that's just fine for now - no urgent need to port to cnrfs for the benchmarks we're looking at.

I'm asking because while the advance_fs_replica() logic remains, the tlb work queues remain large/complicated (#290). So it might be nice to document that implementing this for cnrfs would fix that issue :)

@@ -31,6 +31,7 @@ fn s04_userspace_multicore() {
.user_feature("test-scheduler-smp")
.build();
let cmdline = RunnerArgs::new_with_build("userspace-smp", &build)
.nodes(num_cores / 16)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this no longer work with full cores? It's unclear to me how 16 plays into this test.

} else {
cmdline = cmdline.nodes(machine.max_numa_nodes());
cmdline = cmdline.nodes(std::cmp::max(machine.max_cores() / 16, machine.max_numa_nodes()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we assuming max 16 cores per numa node? skylake4x has 24, so this may not be a solid assumption?

@@ -834,7 +834,7 @@ fn s10_leveldb_benchmark() {
}

#[test]
fn s10_memcached_benchmark_internal() {
fn s10_xmemcached_benchmark_internal() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo maybe?

@@ -35,7 +35,7 @@ fn maponly_bencher(cores: usize) {

// see process.rs the heap split up by core from slots 1..128, so we start from there
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is out of date

@@ -512,15 +531,12 @@ fn _start(argc: isize, _argv: *const *const u8) -> isize {
crate::nrproc::register_thread_with_process_replicas();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the controller initialized the log but didn't have a replica of it's own, so the total number of process replicas was equal to the number of clients. Reading the code, I believe this is still true, but I wanted to confirm.

@@ -20,6 +20,7 @@ pub(crate) struct ShmemAlloc {
}

impl ShmemAlloc {
#[allow(dead_code)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the logs use allocators at all? Can this be deleted entirely?

}
process_logs
};
// We want to allocate the logs in controller shared memory
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think comment is outdated. We are allocating below from local memory below (local_shmem_affinity())

pcm.set_mem_affinity(mid_to_shmem_affinity(r)).expect("Can't change affinity");
}
AffinityChange::Revert(_orig) => {
pcm.set_mem_affinity(local_shmem_affinity()).expect("Can't set affinity")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local_shmem_affinity() returns a value relative to where it's run. Also - the memory allocator may have been non-shared originally. So we don't want to automatically revert to shmem regardless. I think we need to capture the actual previous value to do this correctly.

gz added 6 commits September 25, 2023 13:19
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
@gz gz force-pushed the new-replica-code branch from fe70c07 to ad53903 Compare September 25, 2023 20:19
@hunhoffe hunhoffe closed this Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants