lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 30 Jun 2011 18:06:53 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
	"bsingharora@...il.com" <bsingharora@...il.com>,
	Michal Hocko <mhocko@...e.cz>, Ying Han <yinghan@...gle.com>,
	Shaohua Li <shaohua.li@...el.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Subject: Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2

On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:

> On Fri, 1 Jul 2011 08:50:13 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> 
> > On Thu, 30 Jun 2011 13:01:34 -0700
> > Andrew Morton <akpm@...ux-foundation.org> wrote:
> 
> > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> > 
> 
> v4 here. Thank you for pointing out. I could think of several ways but
> maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> to be a bug.

No, it isn't a bug - swappiness also controls the kernel's eagerness to
unmap and reclaim mmapped pagecache.

> tested with allyesconfig/allnoconfig.

Did it break the above?

> +#ifdef CONFIG_SWAP
> +static int vmscan_swappiness(struct scan_control *sc)
> +{
> +	if (scanning_global_lru(sc))
> +		return vm_swappiness;

Well that's a bit ugly - it assumes that all callers set
scan_control.swappiness to vm_swappiness then never change it.  That
may be true in the current code.

Ho hum, I guess that's a simplification we can make.

> +	return mem_cgroup_swappiness(sc->mem_cgroup);
> +}
> +#else
> +static int vmscan_swappiness(struct scan_control *sc)
> +{
> +	/* Now, this function is never called with !CONFIG_SWAP */
> +	BUG();
> +	return 0;
> +}
> +#endif
>
> ...
>
> @@ -1789,8 +1804,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
>  	 * With swappiness at 100, anonymous and file have the same priority.
>  	 * This scanning priority is essentially the inverse of IO cost.
>  	 */
> -	anon_prio = sc->swappiness;
> -	file_prio = 200 - sc->swappiness;
> +	anon_prio = vmscan_swappiness(sc);
> +	file_prio = 200 - vmscan_swappiness(sc);

hah, this should go BUG if CONFIG_SWAP=n.  But it won't, because we
broke get_scan_count().  It fails to apply vm_swappiness to file-backed
pages if there's no available swap, which is daft.

I think this happened in 76a33fc380c9a ("vmscan: prevent
get_scan_ratio() rounding errors") which claims "this patch doesn't
really change logics, but just increase precision".


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ