linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@in.ibm.com>
To: dave@sr71.net
Cc: linux-mm@kvack.org
Subject: Re: [RFC][PATCH] "challenged" memory controller
Date: Wed, 16 Aug 2006 19:30:55 +0530	[thread overview]
Message-ID: <44E32517.7040704@in.ibm.com> (raw)
In-Reply-To: <20060815192047.EE4A0960@localhost.localdomain>

dave@sr71.net wrote:
> I've been toying with a little memory controller for the past
> few weeks, on and off.  My goal was to create something simple
> and hackish that would at least be a toy to play with in the
> process of creating something that might actually be feasible.
> 
> I call it "challenged" because it has some definite limitations.
> However, it only adds about 50 lines of code to generic areas
> of the VM, and I haven't been the slightest bit careful, yet.
> I think it probably also breaks CONFIG_PM and !CONFIG_CPUSETS,
> but those are "features". ;)
> 
> It uses cpusets for now, just because they are there, and are
> relatively easy to modify.  The page->cpuset bit is only
> temporary, and I have some plans to remove it later.
> 
> How does it work?  It adds two fields to the scan control
> structure.  One that tells the scan to only pay attention to
> _any_ cpuset over its memory limits, and the other to tell it
> to only scan pages for a _particular_ cpuset.
> 
> I've been pretty indiscriminately hacking away, so I have the
> feeling that there are some more efficient and nicer ways to
> hook into the page scanning logic.  Comments are very welcome.
> 
> Signed-off-by: Dave Hansen <haveblue@us.ibm.com>

<snip>

> +int shrink_cpuset(struct cpuset *cs, gfp_t gfpmask, int tries)
> +{
> +	int nr_shrunk = 0;
> +	while (cpuset_amount_over_memory_max(cs)) {
> +		if (tries-- < 0)
> +			break;
> +		nr_shrunk += shrink_all_memory(10, cs);

shrink_all_memory() is also called from kernel/power/main.c (from 
suspend_prepare()) and we have no cpuset context available from there. We could 
try passing a NULL cpuset maybe?



> +	}
> +	return 0;
> +}
> +
> +int cpuset_inc_nr_pages(struct cpuset *cs, int nr, gfp_t gfpmask)
> +{
> +	int ret;
> +	if (!cs)
> +		return 0;
> +	cs->mems_nr_pages += nr;
> +	if (cpuset_amount_over_memory_max(cs)) {
> +		if (!(gfpmask & __GFP_WAIT))
> +			return -ENOMEM;
> +		ret = shrink_cpuset(cs, gfpmask, 50);
> +	}

We could use __GFP_REPEAT, __GFP_NOFAIL, __GFP_NORETRY to determine the retry 
policy.



> +	if (cpuset_amount_over_memory_max(cs))
> +		return -ENOMEM;
> +	return 0;
> +}

<snip>

-- 

	Balbir Singh,
	Linux Technology Center,
	IBM Software Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2006-08-16 14:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-15 19:20 dave
2006-08-15 22:07 ` Paul Jackson
2006-08-15 22:24   ` Dave Hansen
2006-08-15 22:49     ` Paul Jackson
2006-08-17 10:41   ` Balbir Singh
2006-08-17 14:47     ` Dave Hansen
2006-08-18  3:33       ` Balbir Singh
2006-08-17 16:34     ` Paul Jackson
2006-08-16  5:44 ` Matt Helsley
2006-08-16 14:00 ` Balbir Singh [this message]
2006-08-16 20:31 ` Chandra Seetharaman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44E32517.7040704@in.ibm.com \
    --to=balbir@in.ibm.com \
    --cc=dave@sr71.net \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox