public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stuart Young <cef-lkml@optusnet.com.au>
To: linux-kernel@vger.kernel.org
Cc: Pavel Machek <pavel@suse.cz>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	Nigel Cunningham <ncunningham@linuxmail.org>,
	Andrew Morton <akpm@zip.com.au>, Rob Landley <rob@landley.net>,
	seife@suse.de, Oliver Neukum <oliver@neukum.org>,
	Con Kolivas <kernel@kolivas.org>
Subject: Re: swappiness=0 makes software suspend fail.
Date: Mon, 31 May 2004 16:18:36 +1000	[thread overview]
Message-ID: <200405311618.36739.cef-lkml@optusnet.com.au> (raw)
In-Reply-To: <20040530194731.GA895@elf.ucw.cz>

On Mon, 31 May 2004 05:47, Pavel Machek wrote:
> > Nick Piggin wrote:
> > > Pavel Machek wrote: 
>
> > >Andrew, in 2.6.6 shrink_all_memory() does not work if swappiness ==
> > >0. shrink_all_memory() calls balance_pgdat(), that calls
> > >shrink_zone(), and that calls refill_inactive_zone(), which looks at
> > >swappiness.
> > >
> > >Additional parameter to all these calls neutralizing swappiness would
> > >help, as would temporarily setting swappiness to 100 in
> > >shrink_all_memory. Is there a less ugly solution?
> >
> > I have a cleanup patch that allows this sort of thing to easily
> > be passed into the lower levels of reclaim functions. I don't
> > know if it would be to Andrew's taste though...
> >
> > It basically replaces all function parameters in vmscan.c with
> >
> > struct scan_control {
> > 	unsigned long nr_to_scan;
> > 	unsigned long nr_scanned;
> > 	unsigned long nr_reclaimed;
> > 	unsigned int gfp_mask;
> > 	struct page_state ps;
> > 	int may_writepage;
> > };
> >
> > So you could easily add a field for swsusp.
> >
> > Until something like this goes through, please don't fuglify
> > vmscan.c any more than it is... do the saving and restoring
> > thing that Nigel suggested please.
>
> Okay, this should solve it.
> 							Pavel
>
> --- clean/mm/vmscan.c	2004-05-20 23:08:37.000000000 +0200
> +++ linux/mm/vmscan.c	2004-05-30 21:45:41.000000000 +0200
> @@ -1098,10 +1098,13 @@
>  	pg_data_t *pgdat;
>  	int nr_to_free = nr_pages;
>  	int ret = 0;
> +	int old_swappiness = vm_swappiness;
>  	struct reclaim_state reclaim_state = {
>  		.reclaimed_slab = 0,
>  	};
>
> +	vm_swappiness = 100;
> +
>  	current->reclaim_state = &reclaim_state;
>  	for_each_pgdat(pgdat) {
>  		int freed;
> @@ -1115,6 +1118,8 @@
>  			break;
>  	}
>  	current->reclaim_state = NULL;
> +
> +	vm_swappiness = old_swappiness;
>  	return ret;
>  }
>  #endif

Good stuff. I've cc'ed Con Kolivas in on this as he's just recently posted his 
updated "Autoregulated VM swappiness" patch. In particular, this could also 
cause some issues if it made it into the main tree, as then this code might 
fail/cause issues (eg: as both could end up writing to vm_swappiness at the 
same time). This could possibly be a race condition as per Oliver's earlier 
observation (even if it's non-fatal, it's at least annoying).

Just thinking that Con could check to see somehow wether we're going to 
suspend, and not touch vm_swappiness anymore if that's the case. Yes I know 
the code isn't in the main tree yet, but who knows when another writer to 
vm_swappiness might end up in the main tree. It may also prove a good example 
for other potential writers. Pavel, Nigel, (anyone?) suggestions?

-- 
 Stuart Young (aka Cef)
 cef-lkml@optusnet.com.au is for LKML and related email only

  parent reply	other threads:[~2004-05-31  6:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-28  5:00 swappiness=0 makes software suspend fail Rob Landley
2004-05-28 21:56 ` Pavel Machek
2004-05-29  7:48   ` Nigel Cunningham
2004-05-29  9:05   ` Stuart Young
2004-05-29  8:56     ` Nigel Cunningham
2004-05-29 22:23       ` Pavel Machek
2004-05-31 10:09         ` Andrew Morton
2004-05-31 10:42           ` Nick Piggin
2004-05-31 10:17         ` Andrew Morton
2004-05-31 11:38           ` Rob Landley
2004-05-31 11:52             ` Pavel Machek
2004-06-01 10:46               ` Nigel Cunningham
2004-06-03 12:08                 ` Pavel Machek
2004-05-31 22:57             ` Flavio Stanchina
2004-06-04 12:20               ` Pavel Machek
2004-05-31 11:50           ` Pavel Machek
2004-05-31 19:07             ` Stefan Seyfried
2004-05-29 22:36       ` Pavel Machek
2004-05-30  2:21         ` Nick Piggin
2004-05-30 19:47           ` Pavel Machek
2004-05-30 23:23             ` Oliver Neukum
2004-05-31  3:28               ` Rob Landley
2004-05-31  6:18             ` Stuart Young [this message]
2004-05-31  8:41               ` Pavel Machek
2004-05-29 11:35     ` Pavel Machek

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=200405311618.36739.cef-lkml@optusnet.com.au \
    --to=cef-lkml@optusnet.com.au \
    --cc=akpm@zip.com.au \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncunningham@linuxmail.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=oliver@neukum.org \
    --cc=pavel@suse.cz \
    --cc=rob@landley.net \
    --cc=seife@suse.de \
    /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