Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752580Ab0DMJwZ (ORCPT ); Tue, 13 Apr 2010 05:52:25 -0400 Received: from casper.infradead.org ([85.118.1.10]:51026 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112Ab0DMJwX convert rfc822-to-8bit (ORCPT ); Tue, 13 Apr 2010 05:52:23 -0400 Subject: Re: [PATCH 1/4] Simplify and comment on anon_vma re-use for anon_vma_prepare() From: Peter Zijlstra To: Linus Torvalds Cc: Borislav Petkov , Rik van Riel , Johannes Weiner , KOSAKI Motohiro , Andrew Morton , Minchan Kim , Linux Kernel Mailing List , Lee Schermerhorn , Nick Piggin , Andrea Arcangeli , Hugh Dickins , sgunderson@bigfoot.com In-Reply-To: References: <20100411130801.GA7189@a1.tnic> <20100411185508.GA4450@liondog.tnic> <20100412072056.GA2432@liondog.tnic> <4BC36916.3080005@redhat.com> <20100412190002.GA8595@a1.tnic> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Date: Tue, 13 Apr 2010 11:51:38 +0200 Message-ID: <1271152298.4807.1009.camel@twins> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1166 Lines: 38 On Mon, 2010-04-12 at 13:22 -0700, Linus Torvalds wrote: > +static int anon_vma_compatible(struct vm_area_struct *a, struct vm_area_struct *b) > +{ > + return a->vm_end == b->vm_start && > + mpol_equal(vma_policy(a), vma_policy(b)) && > + a->vm_file == b->vm_file && > + !((a->vm_flags ^ b->vm_flags) & ~(VM_READ|VM_WRITE|VM_EXEC)) && > + b->vm_pgoff == a->vm_pgoff + ((b->vm_start - a->vm_start) >> PAGE_SHIFT); > +} Maybe write that as: static int anon_vma_compatible(struct vm_area_struct *a, struct vm_area_struct *b) { if (a->vm_end != b->vm_start) return 0; if (!mpol_equal(vma_policy(a), vma_policy(b)) return 0; if (a->vm_file != b->vm_file) return 0; if ((a->vm_flags ^ b->vm_flags) & ~(VM_READ|VM_WRITE|VM_EXEC)) return 0; if (a->vm_pgoff + ((b->vm_start - a->vm_start) >> PAGE_SHIFT) != b->vm_pgoff) return 0; return 1; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/