* [PATCH 1/2] mm/percpu.c: renew the max_contig if we merge the head and previous block.
@ 2014-03-27 11:05 Jianyu Zhan
2014-03-27 14:57 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Jianyu Zhan @ 2014-03-27 11:05 UTC (permalink / raw)
To: linux-mm; +Cc: akpm, tj, cl, linux-kernel, nasa4836
During pcpu_alloc_area(), we might merge the current head with the
previous block. Since we have calculated the max_contig using the
size of previous block before we skip it, and now we update the size
of previous block, so we should renew the max_contig.
Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
---
mm/percpu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index 036cfe0..cfda29c 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -506,9 +506,11 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align)
* uncommon for percpu allocations.
*/
if (head && (head < sizeof(int) || chunk->map[i - 1] > 0)) {
- if (chunk->map[i - 1] > 0)
+ if (chunk->map[i - 1] > 0) {
chunk->map[i - 1] += head;
- else {
+ max_contig =
+ max(chunk->map[i - 1], max_contig);
+ } else {
chunk->map[i - 1] -= head;
chunk->free_size -= head;
}
--
1.8.5.3
--
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>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] mm/percpu.c: renew the max_contig if we merge the head and previous block.
2014-03-27 11:05 [PATCH 1/2] mm/percpu.c: renew the max_contig if we merge the head and previous block Jianyu Zhan
@ 2014-03-27 14:57 ` Tejun Heo
0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2014-03-27 14:57 UTC (permalink / raw)
To: Jianyu Zhan; +Cc: linux-mm, akpm, cl, linux-kernel
On Thu, Mar 27, 2014 at 07:05:43PM +0800, Jianyu Zhan wrote:
> During pcpu_alloc_area(), we might merge the current head with the
> previous block. Since we have calculated the max_contig using the
> size of previous block before we skip it, and now we update the size
> of previous block, so we should renew the max_contig.
pcpu_alloc_area() has been reimplemented in percpu/for-3.15. Can you
please refresh the patch against the new implementation?
Thanks.
--
tejun
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] mm/percpu.c: renew the max_contig if we merge the head and previous block
@ 2014-03-28 12:55 Jianyu Zhan
2014-03-29 13:30 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Jianyu Zhan @ 2014-03-28 12:55 UTC (permalink / raw)
To: linux-mm; +Cc: akpm, tj, cl, linux-kernel, nasa4836
Hi, tj,
I've reworked the patches on top of percpu/for-3.15.
During pcpu_alloc_area(), we might merge the current head with the
previous block. Since we have calculated the max_contig using the
size of previous block before we skip it, and now we update the size
of previous block, so we should renew the max_contig.
Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
---
mm/percpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index 202e104..63e24fb 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -473,9 +473,11 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align)
* uncommon for percpu allocations.
*/
if (head && (head < sizeof(int) || !(p[-1] & 1))) {
+ *p = off += head;
if (p[-1] & 1)
chunk->free_size -= head;
- *p = off += head;
+ else
+ max_contig = max(*p - p[-1], max_contig);
this_size -= head;
head = 0;
}
--
1.8.5.3
--
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>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] mm/percpu.c: renew the max_contig if we merge the head and previous block
2014-03-28 12:55 Jianyu Zhan
@ 2014-03-29 13:30 ` Tejun Heo
0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2014-03-29 13:30 UTC (permalink / raw)
To: Jianyu Zhan; +Cc: linux-mm, akpm, cl, linux-kernel
On Fri, Mar 28, 2014 at 08:55:21PM +0800, Jianyu Zhan wrote:
> Hi, tj,
> I've reworked the patches on top of percpu/for-3.15.
>
> During pcpu_alloc_area(), we might merge the current head with the
> previous block. Since we have calculated the max_contig using the
> size of previous block before we skip it, and now we update the size
> of previous block, so we should renew the max_contig.
>
> Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
Applied to percpu/for-3.15.
Thanks!
--
tejun
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-29 13:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 11:05 [PATCH 1/2] mm/percpu.c: renew the max_contig if we merge the head and previous block Jianyu Zhan
2014-03-27 14:57 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2014-03-28 12:55 Jianyu Zhan
2014-03-29 13:30 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).