From: Roger Larsson <roger.larsson@norran.net>
To: "Juan J. Quintela" <quintela@fi.udc.es>
Cc: linux-mm@kvack.org
Subject: Re: PATCH: Improvements in shrink_mmap and kswapd
Date: Sun, 18 Jun 2000 02:51:31 +0200 [thread overview]
Message-ID: <394C1D13.F39ECFD8@norran.net> (raw)
In-Reply-To: <ytt3dmcyli7.fsf@serpe.mitica>
Hi,
Comments below,
"Juan J. Quintela" wrote:
>
> Hi
> this patch makes kswapd use less resources. It should solve
> the kswapd eats xx% of my CPU problems. It appears that it improves
> IO a bit here. Could people having problems with IO told me if this
> patch improves things, I am interested in knowing that it don't makes
> things worst never. This patch is stable here. I am finishing the
> deferred mmaped pages form file writing patch, that should solve
> several other problems.
>
> Reports of success/failure are welcome. Comments are also welcome.
>
> Later, Juan.
>
> +/**
> + * shrink_mmap - Tries to free memory
> + * @priority: how hard we will try to free pages (0 hardest)
> + * @gfp_mask: Restrictions to free pages
> + *
> + * This function walks the lru list searching for free pages. It
> + * returns 1 to indicate success and 0 in the opposite case. It gets a
> + * lock in the pagemap_lru_lock and the pagecache_lock.
> */
> +/* nr_to_examinate counts the number of pages that we will read as
> + * maximum as each call. This means that we don't loop.
> + */
> +/* nr_writes counts the number of writes that we have started to the
> + * moment. We limitate the number of writes in each round to
> + * max_page_launder. ToDo: Make that variable tunable through sysctl.
> + */
> +const int max_page_launder = 100;
> +
> int shrink_mmap(int priority, int gfp_mask)
> {
> - int ret = 0, count, nr_dirty;
> struct list_head * page_lru;
> struct page * page = NULL;
> -
> - count = nr_lru_pages / (priority + 1);
> - nr_dirty = priority;
> + int ret;
> + int nr_to_examinate = nr_lru_pages;
Is this really enough?
PG_AGE_MAX * nr_lru_pages / (priority + 1)
is required to ensure that all pages have been scanned at an age of 0.
But that is probably an overkill... there is a sum involved here...
PG_AGE_START * ...
Could be nice to get rid of streaming pages before other attempts are
done.
> diff -urN --exclude-from=/home/lfcia/quintela/work/kernel/exclude base/mm/vmscan.c working/mm/vmscan.c
> --- base/mm/vmscan.c Sat Jun 17 23:51:24 2000
> +++ working/mm/vmscan.c Sun Jun 18 00:28:12 2000
>
> [removed stuff]
>
> @@ -427,6 +425,32 @@
> return __ret;
> }
>
> +/**
> + * memory_pressure - Is the system under memory pressure
> + *
> + * Returns 1 if the system is low on memory in any of its zones,
> + * otherwise returns 0.
> + */
> +int memory_pressure(void)
> +{
> + pg_data_t *pgdat = pgdat_list;
> +
> + do {
> + int i;
> + for(i = 0; i < MAX_NR_ZONES; i++) {
> + zone_t *zone = pgdat->node_zones + i;
> + if (!zone->size || !zone->zone_wake_kswapd)
> + continue;
> + if (zone->free_pages < zone->pages_low)
> + return 1;
> + }
> + pgdat = pgdat->node_next;
> +
> + } while (pgdat);
> +
> + return 0;
> +}
> +
This function effectively ignore 'zone_wake_kswapd' since it should
always be set when free < low - if correct behaviour remove the test.
> priority = 64;
> do {
> while (shrink_mmap(priority, gfp_mask)) {
> - ret = 1;
> if (!--count)
> goto done;
> }
>
> + if(!memory_pressure())
> + return 1;
>
Needs lower than pages_low after shrink_mmap to pass this test and
enter swapping... might be correct behaviour!
/RogerL
--
Home page:
http://www.norran.net/nra02596/
--
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.eu.org/Linux-MM/
next prev parent reply other threads:[~2000-06-18 0:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-17 22:45 Juan J. Quintela
2000-06-17 23:12 ` Rik van Riel
2000-06-17 23:30 ` Roger Larsson
2000-06-17 23:42 ` Philipp Rumpf
2000-06-18 0:00 ` Roger Larsson
2000-06-18 0:51 ` Roger Larsson [this message]
2000-06-18 7:57 ` Mike Galbraith
2000-06-19 23:15 ` PATCH: Improvements in shrink_mmap and kswapd (take 2) Juan J. Quintela
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=394C1D13.F39ECFD8@norran.net \
--to=roger.larsson@norran.net \
--cc=linux-mm@kvack.org \
--cc=quintela@fi.udc.es \
/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