Re: [PATCH 04/20] Convert gfp_zone() to use a table of precalculatedvalues

From: Christoph Lameter
Date: Mon Feb 23 2009 - 10:32:46 EST


On Sun, 22 Feb 2009, Mel Gorman wrote:

> Every page allocation uses gfp_zone() to calcuate what the highest zone
> allowed by a combination of GFP flags is. This is a large number of branches
> to have in a fast path. This patch replaces the branches with a lookup
> table that is calculated at boot-time and stored in the read-mostly section
> so it can be shared. This requires __GFP_MOVABLE to be redefined but it's
> debatable as to whether it should be considered a zone modifier or not.

Are you sure that this is a benefit? Jumps are forward and pretty short
and the compiler is optimizing a branch away in the current code.


0xffffffff8027bde8 <try_to_free_pages+95>: mov %esi,-0x58(%rbp)
0xffffffff8027bdeb <try_to_free_pages+98>: movq $0xffffffff80278cd0,-0x48(%rbp)
0xffffffff8027bdf3 <try_to_free_pages+106>: test $0x1,%r8b
0xffffffff8027bdf7 <try_to_free_pages+110>: mov 0x620(%rax),%rax
0xffffffff8027bdfe <try_to_free_pages+117>: mov %rax,-0x88(%rbp)
0xffffffff8027be05 <try_to_free_pages+124>: jne 0xffffffff8027be2c <try_to_free_pages+163>
0xffffffff8027be07 <try_to_free_pages+126>: mov $0x1,%r14d
0xffffffff8027be0d <try_to_free_pages+132>: test $0x4,%r8b
0xffffffff8027be11 <try_to_free_pages+136>: jne 0xffffffff8027be2c <try_to_free_pages+163>
0xffffffff8027be13 <try_to_free_pages+138>: xor %r14d,%r14d
0xffffffff8027be16 <try_to_free_pages+141>: and $0x100002,%r8d
0xffffffff8027be1d <try_to_free_pages+148>: cmp $0x100002,%r8d
0xffffffff8027be24 <try_to_free_pages+155>: sete %r14b
0xffffffff8027be28 <try_to_free_pages+159>: add $0x2,%r14d
0xffffffff8027be2c <try_to_free_pages+163>: mov %gs:0x8,%rdx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/