From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: David Rientjes <rientjes@google.com>,
Pekka Enberg <penberg@kernel.org>, Mel Gorman <mgorman@suse.de>,
Glauber Costa <glommer@parallels.com>,
Michal Hocko <mhocko@suse.cz>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
Luiz Capitulino <lcapitulino@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Thelen <gthelen@google.com>,
Leonid Moiseichuk <leonid.moiseichuk@nokia.com>,
KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
Minchan Kim <minchan@kernel.org>,
John Stultz <john.stultz@linaro.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linaro-kernel@lists.linaro.org, patches@linaro.org,
kernel-team@android.com
Subject: Re: [RFC v2] Add mempressure cgroup
Date: Mon, 10 Dec 2012 13:23:09 +0100 [thread overview]
Message-ID: <201212101323.09806.b.zolnierkie@samsung.com> (raw)
In-Reply-To: <20121210095838.GA21065@lizard>
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, 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>
next prev parent reply other threads:[~2012-12-10 12:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-10 9:58 Anton Vorontsov
2012-12-10 11:50 ` Kirill A. Shutemov
2012-12-10 20:08 ` Anton Vorontsov
2012-12-10 12:23 ` Bartlomiej Zolnierkiewicz [this message]
2012-12-10 20:05 ` Anton Vorontsov
2012-12-11 13:22 ` Bartlomiej Zolnierkiewicz
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=201212101323.09806.b.zolnierkie@samsung.com \
--to=b.zolnierkie@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=anton.vorontsov@linaro.org \
--cc=glommer@parallels.com \
--cc=gthelen@google.com \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=kirill@shutemov.name \
--cc=kosaki.motohiro@gmail.com \
--cc=lcapitulino@redhat.com \
--cc=leonid.moiseichuk@nokia.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=minchan@kernel.org \
--cc=patches@linaro.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
/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