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]
Message-id: <201212101323.09806.b.zolnierkie@samsung.com>
Date:	Mon, 10 Dec 2012 13:23:09 +0100
From:	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To:	Anton Vorontsov <anton.vorontsov@...aro.org>
Cc:	David Rientjes <rientjes@...gle.com>,
	Pekka Enberg <penberg@...nel.org>,
	Mel Gorman <mgorman@...e.de>,
	Glauber Costa <glommer@...allels.com>,
	Michal Hocko <mhocko@...e.cz>,
	"Kirill A. Shutemov" <kirill@...temov.name>,
	Luiz Capitulino <lcapitulino@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Greg Thelen <gthelen@...gle.com>,
	Leonid Moiseichuk <leonid.moiseichuk@...ia.com>,
	KOSAKI Motohiro <kosaki.motohiro@...il.com>,
	Minchan Kim <minchan@...nel.org>,
	John Stultz <john.stultz@...aro.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, linaro-kernel@...ts.linaro.org,
	patches@...aro.org, kernel-team@...roid.com
Subject: Re: [RFC v2] Add mempressure cgroup

On Monday 10 December 2012 10:58:38 Anton Vorontsov wrote:

> +static void consume_memory(void)
> +{
> +	unsigned int i = 0;
> +	unsigned int j = 0;
> +
> +	puts("consuming memory...");
> +
> +	while (1) {
> +		pthread_mutex_lock(&locks[i]);
> +		if (!chunks[i]) {
> +			chunks[i] = malloc(CHUNK_SIZE);
> +			pabort(!chunks[i], 0, "chunks alloc failed");
> +			memset(chunks[i], 0, CHUNK_SIZE);
> +			j++;
> +		}
> +		pthread_mutex_unlock(&locks[i]);
> +
> +		if (j >= num_chunks / 10) {
> +			add_reclaimable(num_chunks / 10);

Shouldn't it use j instead of num_chunks / 10 here?

> +			printf("added %d reclaimable chunks\n", j);
> +			j = 0;
> +		}
> +
> +		i = (i + 1) % num_chunks;
> +	}
> +}

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung Poland R&D Center
--
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