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

difference between the reclaim threshold alpha described in the paper and its actual implementation #7

Open
ShiningChuang opened this issue Nov 7, 2023 · 1 comment

Comments

@ShiningChuang
Copy link

paper Can Far Memory Improve Job Throughput? says:

To prevent cgroups from significantly exceeding their memory allocation, Fastswap gives each cgroup a small threshold α of memory above its limit. When a cgroup first reaches its memory limit, the memory controller requests offloaded reclaim. If the reclaimer is busy and cannot service reclamation requests fast enough, memory in the requesting cgroup will keep increasing. Once the cgroup exceeds its memory limit by α, page fault handlers for the cgroup will perform direct reclaim as well. This guarantees that the cgroup does not exceed its limit by more than α. In our implementation we use α =8MB. If a node is not using far memory, the reclaimer is idle, so the CPU can be used to execute jobs

However, in the actual implementation of the code, it seems that it is not used α:

static void high_work_func(struct work_struct *work)
{
	struct mem_cgroup *memcg = container_of(work, struct mem_cgroup, high_work);
	unsigned long high = memcg->high;
	unsigned long nr_pages = page_counter_read(&memcg->memory);
	unsigned long reclaim;

	if (nr_pages > high) {
		reclaim = min(nr_pages - high, MAX_RECLAIM_OFFLOAD);

		/* reclaim_high only reclaims iff nr_pages > high */
		reclaim_high(memcg, reclaim, GFP_KERNEL);
	}

	if (page_counter_read(&memcg->memory) > memcg->high)
		schedule_work_on(FASTSWAP_RECLAIM_CPU, &memcg->high_work);
}

Did I miss anything?

@amaro
Copy link
Collaborator

amaro commented Nov 7, 2023

Yes. MAX_RECLAIM_OFFLOAD is α.

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

No branches or pull requests

2 participants