From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
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 12:05:12 -0800 [thread overview]
Message-ID: <20121210200512.GA499@lizard> (raw)
In-Reply-To: <201212101323.09806.b.zolnierkie@samsung.com>
On Mon, Dec 10, 2012 at 01:23:09PM +0100, Bartlomiej Zolnierkiewicz wrote:
> 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?
Um.. They should be equal. Or am I missing the point?
> > + printf("added %d reclaimable chunks\n", j);
> > + j = 0;
Here, we reset it.
> > + }
> > +
> > + i = (i + 1) % num_chunks;
> > + }
> > +}
Thanks!
Anton.
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
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 12:05:12 -0800 [thread overview]
Message-ID: <20121210200512.GA499@lizard> (raw)
In-Reply-To: <201212101323.09806.b.zolnierkie@samsung.com>
On Mon, Dec 10, 2012 at 01:23:09PM +0100, Bartlomiej Zolnierkiewicz wrote:
> 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?
Um.. They should be equal. Or am I missing the point?
> > + printf("added %d reclaimable chunks\n", j);
> > + j = 0;
Here, we reset it.
> > + }
> > +
> > + i = (i + 1) % num_chunks;
> > + }
> > +}
Thanks!
Anton.
next prev parent reply other threads:[~2012-12-10 20:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-10 9:58 [RFC v2] Add mempressure cgroup Anton Vorontsov
2012-12-10 9:58 ` Anton Vorontsov
2012-12-10 11:50 ` Kirill A. Shutemov
2012-12-10 11:50 ` Kirill A. Shutemov
2012-12-10 20:08 ` Anton Vorontsov
2012-12-10 20:08 ` Anton Vorontsov
2012-12-10 12:23 ` Bartlomiej Zolnierkiewicz
2012-12-10 12:23 ` Bartlomiej Zolnierkiewicz
2012-12-10 20:05 ` Anton Vorontsov [this message]
2012-12-10 20:05 ` Anton Vorontsov
2012-12-11 13:22 ` Bartlomiej Zolnierkiewicz
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=20121210200512.GA499@lizard \
--to=anton.vorontsov@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=b.zolnierkie@samsung.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.