Re: sparsemem panic in 2.6.17-rc5-mm1 and -mm2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 7 Jun 2006 09:29:50 -0700
Andrew Morton <[email protected]> wrote:

> Note that the code can be optimised:
> 
> 	if (page_zone_id(page) != page_zone_id(buddy))
> 
> ...
> 
> static inline int page_zone_id(struct page *page)
> {
> 	return (page->flags >> ZONETABLE_PGSHIFT) & ZONETABLE_MASK;
> }
> 
> We don't need to perform the shift to make that comparison.  If the
> compiler's sufficiently smart it will be able to optimise that for us.
> 
> <checks>
> 
>         shrl    $30, %edx       #, <variable>.flags
>         shrl    $30, %eax       #, <variable>.flags
>         cmpl    %eax, %edx      # <variable>.flags, <variable>.flags
> 
> Nope, not smart enough.

I take it back:

.LFB856:
	.loc 1 314 0
.LVL540:
	pushl	%ebp	#
.LCFI419:
	movl	%esp, %ebp	#,
.LCFI420:
	pushl	%ebx	#
.LCFI421:
	.loc 1 314 0
	movl	%edx, %ebx	# buddy, buddy
	.loc 1 320 0
	movl	(%eax), %edx	# <variable>.flags, <variable>.flags
.LVL541:
	movl	(%ebx), %eax	# <variable>.flags, <variable>.flags
.LVL542:
	shrl	$30, %edx	#, <variable>.flags
	shrl	$30, %eax	#, <variable>.flags
	cmpl	%eax, %edx	# <variable>.flags, <variable>.flags
	jne	.L587	#,
.LBB1082:

The compiler's done something sneaky there and has omitted the masking.


Anyway.  It sure doesn't look like it's worth a config option.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux