From: Johannes Weiner <hannes@cmpxchg.org>
To: PINTU KUMAR <pintu_agarwal@yahoo.com>
Cc: Pintu Kumar <pintu.k@samsung.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"mgorman@suse.de" <mgorman@suse.de>,
"jiang.liu@huawei.com" <jiang.liu@huawei.com>,
"minchan@kernel.org" <minchan@kernel.org>,
"cody@linux.vnet.ibm.com" <cody@linux.vnet.ibm.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"cpgs@samsung.com" <cpgs@samsung.com>
Subject: Re: [PATCH 2/2] mm: page_alloc: avoid slowpath for more than MAX_ORDER allocation.
Date: Tue, 23 Jul 2013 00:35:20 -0400 [thread overview]
Message-ID: <20130723043520.GH715@cmpxchg.org> (raw)
In-Reply-To: <1374544878.92541.YahooMailNeo@web160102.mail.bf1.yahoo.com>
On Mon, Jul 22, 2013 at 07:01:18PM -0700, PINTU KUMAR wrote:
> >Lastly, order >= MAX_ORDER is not supported by the page allocator, and
> >we do not want to punish 99.999% of all legitimate page allocations in
> >the fast path in order to catch an unlikely situation like this.
[...]
> >Having the check only in the slowpath is a good thing.
> >
> Sorry, I could not understand, why adding this check in slowpath is only good.
> We could have returned failure much before that.
> Without this check, we are actually allowing failure of "first allocation attempt" and then returning the cause of failure in slowpath.
> I thought it will be better to track the unlikely failure in the system as early as possible, at least from the embedded system prospective.
> Let me know your opinion.
This is a trade-off between two cases: we expect (almost) all
allocations to be order < MAX_ORDER, so we want that path as
lightweight as possible. On the other hand, we expect that only very
rarely an allocation will specify order >= MAX_ORDER. By doing the
check late, we make the common case faster at the expense of the rare
case. That's the whole point of having a fast path and a slow path.
What you are proposing would punish 99.999% of all cases in order to
speed up the 0.001% cases. In addition, these 0.001% of all cases
will fail the allocation, so performance is the least of their
worries. It's a bad trade-off.
--
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: Johannes Weiner <hannes@cmpxchg.org>
To: PINTU KUMAR <pintu_agarwal@yahoo.com>
Cc: Pintu Kumar <pintu.k@samsung.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"mgorman@suse.de" <mgorman@suse.de>,
"jiang.liu@huawei.com" <jiang.liu@huawei.com>,
"minchan@kernel.org" <minchan@kernel.org>,
"cody@linux.vnet.ibm.com" <cody@linux.vnet.ibm.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"cpgs@samsung.com" <cpgs@samsung.com>
Subject: Re: [PATCH 2/2] mm: page_alloc: avoid slowpath for more than MAX_ORDER allocation.
Date: Tue, 23 Jul 2013 00:35:20 -0400 [thread overview]
Message-ID: <20130723043520.GH715@cmpxchg.org> (raw)
In-Reply-To: <1374544878.92541.YahooMailNeo@web160102.mail.bf1.yahoo.com>
On Mon, Jul 22, 2013 at 07:01:18PM -0700, PINTU KUMAR wrote:
> >Lastly, order >= MAX_ORDER is not supported by the page allocator, and
> >we do not want to punish 99.999% of all legitimate page allocations in
> >the fast path in order to catch an unlikely situation like this.
[...]
> >Having the check only in the slowpath is a good thing.
> >
> Sorry, I could not understand, why adding this check in slowpath is only good.
> We could have returned failure much before that.
> Without this check, we are actually allowing failure of "first allocation attempt" and then returning the cause of failure in slowpath.
> I thought it will be better to track the unlikely failure in the system as early as possible, at least from the embedded system prospective.
> Let me know your opinion.
This is a trade-off between two cases: we expect (almost) all
allocations to be order < MAX_ORDER, so we want that path as
lightweight as possible. On the other hand, we expect that only very
rarely an allocation will specify order >= MAX_ORDER. By doing the
check late, we make the common case faster at the expense of the rare
case. That's the whole point of having a fast path and a slow path.
What you are proposing would punish 99.999% of all cases in order to
speed up the 0.001% cases. In addition, these 0.001% of all cases
will fail the allocation, so performance is the least of their
worries. It's a bad trade-off.
next prev parent reply other threads:[~2013-07-23 4:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-22 11:32 [PATCH 2/2] mm: page_alloc: avoid slowpath for more than MAX_ORDER allocation Pintu Kumar
2013-07-22 11:32 ` Pintu Kumar
2013-07-22 16:38 ` Johannes Weiner
2013-07-22 16:38 ` Johannes Weiner
2013-07-23 2:01 ` PINTU KUMAR
2013-07-23 2:01 ` PINTU KUMAR
2013-07-23 4:35 ` Johannes Weiner [this message]
2013-07-23 4:35 ` Johannes Weiner
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=20130723043520.GH715@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=cody@linux.vnet.ibm.com \
--cc=cpgs@samsung.com \
--cc=jiang.liu@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=minchan@kernel.org \
--cc=pintu.k@samsung.com \
--cc=pintu_agarwal@yahoo.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.