* [RFC] mm: fix a BUG, the page is allocated 2 times
@ 2015-10-12 2:40 ` yalin wang
0 siblings, 0 replies; 14+ messages in thread
From: yalin wang @ 2015-10-12 2:40 UTC (permalink / raw)
To: akpm, vbabka, mgorman, mhocko, rientjes, js1304, kirill.shutemov,
hannes, alexander.h.duyck, linux-mm, linux-kernel
Cc: yalin wang
Remove unlikely(order), because we are sure order is not zero if
code reach here, also add if (page == NULL), only allocate page again if
__rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
mm/page_alloc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0d6f540..de82e2c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
spin_lock_irqsave(&zone->lock, flags);
page = NULL;
- if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
+ if (alloc_flags & ALLOC_HARDER) {
page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
if (page)
trace_mm_page_alloc_zone_locked(page, order, migratetype);
}
-
- page = __rmqueue(zone, order, migratetype, gfp_flags);
+ if (page == NULL)
+ page = __rmqueue(zone, order, migratetype, gfp_flags);
spin_unlock(&zone->lock);
if (!page)
goto failed;
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [RFC] mm: fix a BUG, the page is allocated 2 times
@ 2015-10-12 2:40 ` yalin wang
0 siblings, 0 replies; 14+ messages in thread
From: yalin wang @ 2015-10-12 2:40 UTC (permalink / raw)
To: akpm, vbabka, mgorman, mhocko, rientjes, js1304, kirill.shutemov,
hannes, alexander.h.duyck, linux-mm, linux-kernel
Cc: yalin wang
Remove unlikely(order), because we are sure order is not zero if
code reach here, also add if (page == NULL), only allocate page again if
__rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
mm/page_alloc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0d6f540..de82e2c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
spin_lock_irqsave(&zone->lock, flags);
page = NULL;
- if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
+ if (alloc_flags & ALLOC_HARDER) {
page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
if (page)
trace_mm_page_alloc_zone_locked(page, order, migratetype);
}
-
- page = __rmqueue(zone, order, migratetype, gfp_flags);
+ if (page == NULL)
+ page = __rmqueue(zone, order, migratetype, gfp_flags);
spin_unlock(&zone->lock);
if (!page)
goto failed;
--
1.9.1
--
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] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
2015-10-12 2:40 ` yalin wang
@ 2015-10-12 7:38 ` Vlastimil Babka
-1 siblings, 0 replies; 14+ messages in thread
From: Vlastimil Babka @ 2015-10-12 7:38 UTC (permalink / raw)
To: yalin wang, akpm, mgorman, mhocko, rientjes, js1304,
kirill.shutemov, hannes, alexander.h.duyck, linux-mm,
linux-kernel
On 10/12/2015 04:40 AM, yalin wang wrote:
> Remove unlikely(order), because we are sure order is not zero if
> code reach here, also add if (page == NULL), only allocate page again if
> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
The second mentioned change is actually more important as it removes a
memory leak! Thanks for catching this. The problem is in patch
mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch
and seems to have been due to a change in the last submitted version to
make sure the tracepoint is called.
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> ---
> mm/page_alloc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0d6f540..de82e2c 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
> spin_lock_irqsave(&zone->lock, flags);
>
> page = NULL;
> - if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
> + if (alloc_flags & ALLOC_HARDER) {
> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
> if (page)
> trace_mm_page_alloc_zone_locked(page, order, migratetype);
> }
> -
> - page = __rmqueue(zone, order, migratetype, gfp_flags);
> + if (page == NULL)
"if (!page)" is more common and already used below.
We could skip the check for !page in case we don't go through the
ALLOC_HARDER branch, but I guess it's not worth the goto, and hopefully
the compiler is smart enough anyway...
> + page = __rmqueue(zone, order, migratetype, gfp_flags);
> spin_unlock(&zone->lock);
> if (!page)
> goto failed;
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
@ 2015-10-12 7:38 ` Vlastimil Babka
0 siblings, 0 replies; 14+ messages in thread
From: Vlastimil Babka @ 2015-10-12 7:38 UTC (permalink / raw)
To: yalin wang, akpm, mgorman, mhocko, rientjes, js1304,
kirill.shutemov, hannes, alexander.h.duyck, linux-mm,
linux-kernel
On 10/12/2015 04:40 AM, yalin wang wrote:
> Remove unlikely(order), because we are sure order is not zero if
> code reach here, also add if (page == NULL), only allocate page again if
> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
The second mentioned change is actually more important as it removes a
memory leak! Thanks for catching this. The problem is in patch
mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch
and seems to have been due to a change in the last submitted version to
make sure the tracepoint is called.
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> ---
> mm/page_alloc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0d6f540..de82e2c 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
> spin_lock_irqsave(&zone->lock, flags);
>
> page = NULL;
> - if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
> + if (alloc_flags & ALLOC_HARDER) {
> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
> if (page)
> trace_mm_page_alloc_zone_locked(page, order, migratetype);
> }
> -
> - page = __rmqueue(zone, order, migratetype, gfp_flags);
> + if (page == NULL)
"if (!page)" is more common and already used below.
We could skip the check for !page in case we don't go through the
ALLOC_HARDER branch, but I guess it's not worth the goto, and hopefully
the compiler is smart enough anyway...
> + page = __rmqueue(zone, order, migratetype, gfp_flags);
> spin_unlock(&zone->lock);
> if (!page)
> goto failed;
>
--
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] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
2015-10-12 7:38 ` Vlastimil Babka
@ 2015-10-12 7:58 ` yalin wang
-1 siblings, 0 replies; 14+ messages in thread
From: yalin wang @ 2015-10-12 7:58 UTC (permalink / raw)
To: Vlastimil Babka
Cc: Andrew Morton, mgorman, mhocko, David Rientjes, js1304,
Kirill A. Shutemov, hannes, alexander.h.duyck, linux-mm,
linux-kernel
> On Oct 12, 2015, at 15:38, Vlastimil Babka <vbabka@suse.cz> wrote:
>
> On 10/12/2015 04:40 AM, yalin wang wrote:
>> Remove unlikely(order), because we are sure order is not zero if
>> code reach here, also add if (page == NULL), only allocate page again if
>> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
>
> The second mentioned change is actually more important as it removes a memory leak! Thanks for catching this. The problem is in patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch and seems to have been due to a change in the last submitted version to make sure the tracepoint is called.
>
>> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
>> ---
>> mm/page_alloc.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 0d6f540..de82e2c 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
>> spin_lock_irqsave(&zone->lock, flags);
>>
>> page = NULL;
>> - if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
>> + if (alloc_flags & ALLOC_HARDER) {
>> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
>> if (page)
>> trace_mm_page_alloc_zone_locked(page, order, migratetype);
>> }
>> -
>> - page = __rmqueue(zone, order, migratetype, gfp_flags);
>> + if (page == NULL)
>
> "if (!page)" is more common and already used below.
> We could skip the check for !page in case we don't go through the ALLOC_HARDER branch, but I guess it's not worth the goto, and hopefully the compiler is smart enough anyway…
agree with your comments,
do i need send a new patch for this ?
Thanks
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
@ 2015-10-12 7:58 ` yalin wang
0 siblings, 0 replies; 14+ messages in thread
From: yalin wang @ 2015-10-12 7:58 UTC (permalink / raw)
To: Vlastimil Babka
Cc: Andrew Morton, mgorman, mhocko, David Rientjes, js1304,
Kirill A. Shutemov, hannes, alexander.h.duyck, linux-mm,
linux-kernel
> On Oct 12, 2015, at 15:38, Vlastimil Babka <vbabka@suse.cz> wrote:
>
> On 10/12/2015 04:40 AM, yalin wang wrote:
>> Remove unlikely(order), because we are sure order is not zero if
>> code reach here, also add if (page == NULL), only allocate page again if
>> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
>
> The second mentioned change is actually more important as it removes a memory leak! Thanks for catching this. The problem is in patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch and seems to have been due to a change in the last submitted version to make sure the tracepoint is called.
>
>> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
>> ---
>> mm/page_alloc.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 0d6f540..de82e2c 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
>> spin_lock_irqsave(&zone->lock, flags);
>>
>> page = NULL;
>> - if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
>> + if (alloc_flags & ALLOC_HARDER) {
>> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
>> if (page)
>> trace_mm_page_alloc_zone_locked(page, order, migratetype);
>> }
>> -
>> - page = __rmqueue(zone, order, migratetype, gfp_flags);
>> + if (page == NULL)
>
> "if (!page)" is more common and already used below.
> We could skip the check for !page in case we don't go through the ALLOC_HARDER branch, but I guess it's not worth the goto, and hopefully the compiler is smart enough anyway…
agree with your comments,
do i need send a new patch for this ?
Thanks
--
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] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
2015-10-12 7:58 ` yalin wang
@ 2015-10-12 10:05 ` Kirill A. Shutemov
-1 siblings, 0 replies; 14+ messages in thread
From: Kirill A. Shutemov @ 2015-10-12 10:05 UTC (permalink / raw)
To: yalin wang
Cc: Vlastimil Babka, Andrew Morton, mgorman, mhocko, David Rientjes,
js1304, Kirill A. Shutemov, hannes, alexander.h.duyck, linux-mm,
linux-kernel
On Mon, Oct 12, 2015 at 03:58:51PM +0800, yalin wang wrote:
>
> > On Oct 12, 2015, at 15:38, Vlastimil Babka <vbabka@suse.cz> wrote:
> >
> > On 10/12/2015 04:40 AM, yalin wang wrote:
> >> Remove unlikely(order), because we are sure order is not zero if
> >> code reach here, also add if (page == NULL), only allocate page again if
> >> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
> >
> > The second mentioned change is actually more important as it removes a memory leak! Thanks for catching this. The problem is in patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch and seems to have been due to a change in the last submitted version to make sure the tracepoint is called.
> >
> >> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> >> ---
> >> mm/page_alloc.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >> index 0d6f540..de82e2c 100644
> >> --- a/mm/page_alloc.c
> >> +++ b/mm/page_alloc.c
> >> @@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
> >> spin_lock_irqsave(&zone->lock, flags);
> >>
> >> page = NULL;
> >> - if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
> >> + if (alloc_flags & ALLOC_HARDER) {
> >> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
> >> if (page)
> >> trace_mm_page_alloc_zone_locked(page, order, migratetype);
> >> }
> >> -
> >> - page = __rmqueue(zone, order, migratetype, gfp_flags);
> >> + if (page == NULL)
> >
> > "if (!page)" is more common and already used below.
> > We could skip the check for !page in case we don't go through the ALLOC_HARDER branch, but I guess it's not worth the goto, and hopefully the compiler is smart enough anyway…
> agree with your comments,
> do i need send a new patch for this ?
Looks like a two patches to me: memory leak and removing always-true part
of condifition.
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
@ 2015-10-12 10:05 ` Kirill A. Shutemov
0 siblings, 0 replies; 14+ messages in thread
From: Kirill A. Shutemov @ 2015-10-12 10:05 UTC (permalink / raw)
To: yalin wang
Cc: Vlastimil Babka, Andrew Morton, mgorman, mhocko, David Rientjes,
js1304, Kirill A. Shutemov, hannes, alexander.h.duyck, linux-mm,
linux-kernel
On Mon, Oct 12, 2015 at 03:58:51PM +0800, yalin wang wrote:
>
> > On Oct 12, 2015, at 15:38, Vlastimil Babka <vbabka@suse.cz> wrote:
> >
> > On 10/12/2015 04:40 AM, yalin wang wrote:
> >> Remove unlikely(order), because we are sure order is not zero if
> >> code reach here, also add if (page == NULL), only allocate page again if
> >> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
> >
> > The second mentioned change is actually more important as it removes a memory leak! Thanks for catching this. The problem is in patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch and seems to have been due to a change in the last submitted version to make sure the tracepoint is called.
> >
> >> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> >> ---
> >> mm/page_alloc.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >> index 0d6f540..de82e2c 100644
> >> --- a/mm/page_alloc.c
> >> +++ b/mm/page_alloc.c
> >> @@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
> >> spin_lock_irqsave(&zone->lock, flags);
> >>
> >> page = NULL;
> >> - if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
> >> + if (alloc_flags & ALLOC_HARDER) {
> >> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
> >> if (page)
> >> trace_mm_page_alloc_zone_locked(page, order, migratetype);
> >> }
> >> -
> >> - page = __rmqueue(zone, order, migratetype, gfp_flags);
> >> + if (page == NULL)
> >
> > "if (!page)" is more common and already used below.
> > We could skip the check for !page in case we don't go through the ALLOC_HARDER branch, but I guess it's not worth the goto, and hopefully the compiler is smart enough anywaya?|
> agree with your comments,
> do i need send a new patch for this ?
Looks like a two patches to me: memory leak and removing always-true part
of condifition.
--
Kirill A. Shutemov
--
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] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
2015-10-12 10:05 ` Kirill A. Shutemov
@ 2015-10-12 11:22 ` Vlastimil Babka
-1 siblings, 0 replies; 14+ messages in thread
From: Vlastimil Babka @ 2015-10-12 11:22 UTC (permalink / raw)
To: Kirill A. Shutemov, yalin wang
Cc: Andrew Morton, mgorman, mhocko, David Rientjes, js1304,
Kirill A. Shutemov, hannes, alexander.h.duyck, linux-mm,
linux-kernel
On 10/12/2015 12:05 PM, Kirill A. Shutemov wrote:
> On Mon, Oct 12, 2015 at 03:58:51PM +0800, yalin wang wrote:
>>
>>> On Oct 12, 2015, at 15:38, Vlastimil Babka <vbabka@suse.cz> wrote:
>>>
>>> On 10/12/2015 04:40 AM, yalin wang wrote:
>>>> Remove unlikely(order), because we are sure order is not zero if
>>>> code reach here, also add if (page == NULL), only allocate page again if
>>>> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
>>>
>>> The second mentioned change is actually more important as it removes a memory leak! Thanks for catching this. The problem is in patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch and seems to have been due to a change in the last submitted version to make sure the tracepoint is called.
>>>
>>>> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
>>>> ---
>>>> mm/page_alloc.c | 6 +++---
>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>>> index 0d6f540..de82e2c 100644
>>>> --- a/mm/page_alloc.c
>>>> +++ b/mm/page_alloc.c
>>>> @@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
>>>> spin_lock_irqsave(&zone->lock, flags);
>>>>
>>>> page = NULL;
>>>> - if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
>>>> + if (alloc_flags & ALLOC_HARDER) {
>>>> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
>>>> if (page)
>>>> trace_mm_page_alloc_zone_locked(page, order, migratetype);
>>>> }
>>>> -
>>>> - page = __rmqueue(zone, order, migratetype, gfp_flags);
>>>> + if (page == NULL)
>>>
>>> "if (!page)" is more common and already used below.
>>> We could skip the check for !page in case we don't go through the ALLOC_HARDER branch, but I guess it's not worth the goto, and hopefully the compiler is smart enough anyway…
>> agree with your comments,
>> do i need send a new patch for this ?
I'd guess no need to, Andrew can edit the patch?
>
> Looks like a two patches to me: memory leak and removing always-true part
> of condifition.
Yeah but I'd expect both would be in the end folded into the buggy patch
in -mm?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
@ 2015-10-12 11:22 ` Vlastimil Babka
0 siblings, 0 replies; 14+ messages in thread
From: Vlastimil Babka @ 2015-10-12 11:22 UTC (permalink / raw)
To: Kirill A. Shutemov, yalin wang
Cc: Andrew Morton, mgorman, mhocko, David Rientjes, js1304,
Kirill A. Shutemov, hannes, alexander.h.duyck, linux-mm,
linux-kernel
On 10/12/2015 12:05 PM, Kirill A. Shutemov wrote:
> On Mon, Oct 12, 2015 at 03:58:51PM +0800, yalin wang wrote:
>>
>>> On Oct 12, 2015, at 15:38, Vlastimil Babka <vbabka@suse.cz> wrote:
>>>
>>> On 10/12/2015 04:40 AM, yalin wang wrote:
>>>> Remove unlikely(order), because we are sure order is not zero if
>>>> code reach here, also add if (page == NULL), only allocate page again if
>>>> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
>>>
>>> The second mentioned change is actually more important as it removes a memory leak! Thanks for catching this. The problem is in patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch and seems to have been due to a change in the last submitted version to make sure the tracepoint is called.
>>>
>>>> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
>>>> ---
>>>> mm/page_alloc.c | 6 +++---
>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>>> index 0d6f540..de82e2c 100644
>>>> --- a/mm/page_alloc.c
>>>> +++ b/mm/page_alloc.c
>>>> @@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
>>>> spin_lock_irqsave(&zone->lock, flags);
>>>>
>>>> page = NULL;
>>>> - if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
>>>> + if (alloc_flags & ALLOC_HARDER) {
>>>> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
>>>> if (page)
>>>> trace_mm_page_alloc_zone_locked(page, order, migratetype);
>>>> }
>>>> -
>>>> - page = __rmqueue(zone, order, migratetype, gfp_flags);
>>>> + if (page == NULL)
>>>
>>> "if (!page)" is more common and already used below.
>>> We could skip the check for !page in case we don't go through the ALLOC_HARDER branch, but I guess it's not worth the goto, and hopefully the compiler is smart enough anywaya?|
>> agree with your comments,
>> do i need send a new patch for this ?
I'd guess no need to, Andrew can edit the patch?
>
> Looks like a two patches to me: memory leak and removing always-true part
> of condifition.
Yeah but I'd expect both would be in the end folded into the buggy patch
in -mm?
--
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] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
2015-10-12 2:40 ` yalin wang
@ 2015-10-12 13:52 ` Mel Gorman
-1 siblings, 0 replies; 14+ messages in thread
From: Mel Gorman @ 2015-10-12 13:52 UTC (permalink / raw)
To: yalin wang
Cc: akpm, vbabka, mhocko, rientjes, js1304, kirill.shutemov, hannes,
alexander.h.duyck, linux-mm, linux-kernel
On Mon, Oct 12, 2015 at 10:40:06AM +0800, yalin wang wrote:
> Remove unlikely(order), because we are sure order is not zero if
> code reach here, also add if (page == NULL), only allocate page again if
> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
>
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
Thanks very much for catching this!
Acked-by: Mel Gorman <mgorman@techsingularity.net>
With your current subject and changelog, there is a small risk that Andrew
will miss this or not see it for some time. Would you mind resending the
patch with a changelog similar to this please? It spells out that it is
a fix to an mmotm patch so it'll be obvious where it should be inserted
before merging to mainline.
From: yalin wang <yalin.wang2010@gmail.com>
Subject: [PATCH] mm, page_alloc: reserve pageblocks for high-order atomic allocations on demand -fix
There is a redundant check and a memory leak introduced by a patch in
mmotm. This patch removes an unlikely(order) check as we are sure order
is not zero at the time. It also checks if a page is already allocated
to avoid a memory leak.
This is a fix to the mmotm patch
mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch
Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
@ 2015-10-12 13:52 ` Mel Gorman
0 siblings, 0 replies; 14+ messages in thread
From: Mel Gorman @ 2015-10-12 13:52 UTC (permalink / raw)
To: yalin wang
Cc: akpm, vbabka, mhocko, rientjes, js1304, kirill.shutemov, hannes,
alexander.h.duyck, linux-mm, linux-kernel
On Mon, Oct 12, 2015 at 10:40:06AM +0800, yalin wang wrote:
> Remove unlikely(order), because we are sure order is not zero if
> code reach here, also add if (page == NULL), only allocate page again if
> __rmqueue_smallest() failed or alloc_flags & ALLOC_HARDER == 0
>
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
Thanks very much for catching this!
Acked-by: Mel Gorman <mgorman@techsingularity.net>
With your current subject and changelog, there is a small risk that Andrew
will miss this or not see it for some time. Would you mind resending the
patch with a changelog similar to this please? It spells out that it is
a fix to an mmotm patch so it'll be obvious where it should be inserted
before merging to mainline.
From: yalin wang <yalin.wang2010@gmail.com>
Subject: [PATCH] mm, page_alloc: reserve pageblocks for high-order atomic allocations on demand -fix
There is a redundant check and a memory leak introduced by a patch in
mmotm. This patch removes an unlikely(order) check as we are sure order
is not zero at the time. It also checks if a page is already allocated
to avoid a memory leak.
This is a fix to the mmotm patch
mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch
Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
--
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] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
2015-10-12 13:52 ` Mel Gorman
@ 2015-10-13 1:43 ` yalin wang
-1 siblings, 0 replies; 14+ messages in thread
From: yalin wang @ 2015-10-13 1:43 UTC (permalink / raw)
To: Mel Gorman
Cc: akpm, vbabka, mhocko, rientjes, js1304, kirill.shutemov, hannes,
alexander.h.duyck, linux-mm, linux-kernel
> On Oct 12, 2015, at 21:52, Mel Gorman <mgorman@techsingularity.net> wrote:
>
> There is a redundant check and a memory leak introduced by a patch in
> mmotm. This patch removes an unlikely(order) check as we are sure order
> is not zero at the time. It also checks if a page is already allocated
> to avoid a memory leak.
>
> This is a fix to the mmotm patch
> mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch
>
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> Acked-by: Mel Gorman <mgorman@techsingularity.net>
no problem,
i have send the patch again using your change log .
Thanks
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] mm: fix a BUG, the page is allocated 2 times
@ 2015-10-13 1:43 ` yalin wang
0 siblings, 0 replies; 14+ messages in thread
From: yalin wang @ 2015-10-13 1:43 UTC (permalink / raw)
To: Mel Gorman
Cc: akpm, vbabka, mhocko, rientjes, js1304, kirill.shutemov, hannes,
alexander.h.duyck, linux-mm, linux-kernel
> On Oct 12, 2015, at 21:52, Mel Gorman <mgorman@techsingularity.net> wrote:
>
> There is a redundant check and a memory leak introduced by a patch in
> mmotm. This patch removes an unlikely(order) check as we are sure order
> is not zero at the time. It also checks if a page is already allocated
> to avoid a memory leak.
>
> This is a fix to the mmotm patch
> mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch
>
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> Acked-by: Mel Gorman <mgorman@techsingularity.net>
no problem,
i have send the patch again using your change log .
Thanks
--
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] 14+ messages in thread
end of thread, other threads:[~2015-10-13 1:43 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 2:40 [RFC] mm: fix a BUG, the page is allocated 2 times yalin wang
2015-10-12 2:40 ` yalin wang
2015-10-12 7:38 ` Vlastimil Babka
2015-10-12 7:38 ` Vlastimil Babka
2015-10-12 7:58 ` yalin wang
2015-10-12 7:58 ` yalin wang
2015-10-12 10:05 ` Kirill A. Shutemov
2015-10-12 10:05 ` Kirill A. Shutemov
2015-10-12 11:22 ` Vlastimil Babka
2015-10-12 11:22 ` Vlastimil Babka
2015-10-12 13:52 ` Mel Gorman
2015-10-12 13:52 ` Mel Gorman
2015-10-13 1:43 ` yalin wang
2015-10-13 1:43 ` yalin wang
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.