* [PATCH] mm: change tlb_finish_mmu() to be more simple
@ 2015-11-04 7:35 yalin wang
2015-11-04 8:33 ` Kirill A. Shutemov
2015-11-04 8:36 ` Sergey Senozhatsky
0 siblings, 2 replies; 4+ messages in thread
From: yalin wang @ 2015-11-04 7:35 UTC (permalink / raw)
To: akpm, kirill.shutemov, mgorman, hannes, riel, raindel, willy,
boaz, linux-mm, linux-kernel
Cc: yalin wang
This patch remove unneeded *next temp variable,
make this function more simple to read.
Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
mm/memory.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c
index 7f3b9f2..f0040ed 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -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;
}
--
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 [flat|nested] 4+ messages in thread* Re: [PATCH] mm: change tlb_finish_mmu() to be more simple
2015-11-04 7:35 [PATCH] mm: change tlb_finish_mmu() to be more simple yalin wang
@ 2015-11-04 8:33 ` Kirill A. Shutemov
2015-11-04 8:36 ` Sergey Senozhatsky
1 sibling, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2015-11-04 8:33 UTC (permalink / raw)
To: yalin wang
Cc: akpm, kirill.shutemov, mgorman, hannes, riel, raindel, willy,
boaz, linux-mm, linux-kernel
On Wed, Nov 04, 2015 at 03:35:31PM +0800, yalin wang wrote:
> This patch remove unneeded *next temp variable,
> make this function more simple to read.
>
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> ---
> mm/memory.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 7f3b9f2..f0040ed 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -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)
Use after free? No, thanks.
> free_pages((unsigned long)batch, 0);
> - }
> +
> tlb->local.next = NULL;
> }
>
> --
> 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>
--
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] 4+ messages in thread* Re: [PATCH] mm: change tlb_finish_mmu() to be more simple
2015-11-04 7:35 [PATCH] mm: change tlb_finish_mmu() to be more simple yalin wang
2015-11-04 8:33 ` Kirill A. Shutemov
@ 2015-11-04 8:36 ` Sergey Senozhatsky
2015-11-04 8:46 ` yalin wang
1 sibling, 1 reply; 4+ messages in thread
From: Sergey Senozhatsky @ 2015-11-04 8:36 UTC (permalink / raw)
To: yalin wang
Cc: akpm, kirill.shutemov, mgorman, hannes, riel, raindel, willy,
boaz, linux-mm, linux-kernel
On (11/04/15 15:35), yalin wang wrote:
[..]
>
> - 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 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* Re: [PATCH] mm: change tlb_finish_mmu() to be more simple
2015-11-04 8:36 ` Sergey Senozhatsky
@ 2015-11-04 8:46 ` yalin wang
0 siblings, 0 replies; 4+ messages in thread
From: yalin wang @ 2015-11-04 8:46 UTC (permalink / raw)
To: Sergey Senozhatsky
Cc: Andrew Morton, Kirill A. Shutemov, Mel Gorman, Johannes Weiner,
riel, raindel, willy, boaz, linux-mm, linux-kernel
> On Nov 4, 2015, at 16:36, Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> wrote:
>
> On (11/04/15 15:35), yalin wang wrote:
> [..]
>>
>> - 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
oh, my mistake, my code is buggy here .
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] 4+ messages in thread
end of thread, other threads:[~2015-11-04 8:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-04 7:35 [PATCH] mm: change tlb_finish_mmu() to be more simple yalin wang
2015-11-04 8:33 ` Kirill A. Shutemov
2015-11-04 8:36 ` Sergey Senozhatsky
2015-11-04 8:46 ` yalin wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox