mm: change tlb_finish_mmu() to be more simple
Subsystems (2)
PATCH 1/1 mm: change tlb_finish_mmu() to be more simple
This patch remove unneeded *next temp variable,
make this function more simple to read.
--- mm/memory.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
mm/memory.c +3 -4
@@ -270,17 +270,16 @@ void tlb_flush_mmu(struct mmu_gather *tlb)*/ void tlb_finish_mmu (struct mmu_gather *tlb,unsigned long start,unsigned long end) { -struct mmu_gather_batch *batch, *next; +struct mmu_gather_batch *batch;tlb_flush_mmu (tlb);/* keep the page table cache within bounds */ check_pgt_cache (); -for (batch = tlb->local.next; batch; batch = next) { - next = batch->next; +for (batch = tlb->local.next; batch; batch = batch->next)free_pages ((unsigned long )batch,0 ); - } + tlb->local.next =NULL ; }
Signature · 7 lines
1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 17 lines · yalin wang
This patch remove unneeded *next temp variable,
make this function more simple to read.Signed-off-by yalin wang <[email protected]>--- mm/memory.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)mm/memory.c +0
-1@@ -270,17 +270,16 @@ void tlb_flush_mmu(struct mmu_gather *tlb)*/ void tlb_finish_mmu (struct mmu_gather *tlb,unsigned long start,unsigned long end) { -struct mmu_gather_batch *batch, *next;
mm/memory.c void tlb_flush_mmu(struct mmu_gather *tlb) · line 280
Quoted 10 lines
mm/memory.c +2
-2+struct mmu_gather_batch *batch;tlb_flush_mmu (tlb);/* keep the page table cache within bounds */ check_pgt_cache (); -for (batch = tlb->local.next; batch; batch = next) { - next = batch->next; +for (batch = tlb->local.next; batch; batch = batch->next)
Use after free? No, thanks.
Quoted 14 lines
mm/memory.c +1
-1free_pages ((unsigned long )batch,0 ); - } + tlb->local.next =NULL ; }Signature · 7 lines
1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 7 lines
Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
On (11/04/15 15:35), yalin wang wrote:
[..]
mm/memory.c void tlb_flush_mmu(struct mmu_gather *tlb) · line 281
Quoted 5 lines
mm/memory.c +1
-2-for (batch = tlb->local.next; batch; batch = next) { - next = batch->next; +for (batch = tlb->local.next; batch; batch = batch->next)free_pages ((unsigned long )batch,0 );
accessing batch->next' after calling free_pages() on batch'?
-ss
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Sergey Senozhatsky
On (11/04/15 15:35), yalin wang wrote:
[..]Quoted 1 line
Quoted 8 lines
Quoted 4 lines
mm/memory.c +1
-2-for (batch = tlb->local.next; batch; batch = next) { - next = batch->next; +for (batch = tlb->local.next; batch; batch = batch->next)free_pages((unsigned long)batch, 0);accessing
batch->next' after calling free_pages() onbatch'?-ss
oh, my mistake, my code is buggy here .
Thanks
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>