From patchwork Sun Dec 1 01:57:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11268461 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D53CE17F0 for ; Sun, 1 Dec 2019 01:57:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A208420873 for ; Sun, 1 Dec 2019 01:57:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="q1zajdH+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A208420873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9C5A96B037F; Sat, 30 Nov 2019 20:57:41 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 976B06B0381; Sat, 30 Nov 2019 20:57:41 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B45E6B0383; Sat, 30 Nov 2019 20:57:41 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 720406B037F for ; Sat, 30 Nov 2019 20:57:41 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 379022A87 for ; Sun, 1 Dec 2019 01:57:41 +0000 (UTC) X-FDA: 76214911122.09.lace81_4312809a3981e X-Spam-Summary: 2,0,0,d0d3af6a154e1422,d41d8cd98f00b204,akpm@linux-foundation.org,:aarcange@redhat.com:akpm@linux-foundation.org:catalin.marinas@arm.com:darrick.wong@oracle.com:dave.hansen@linux.intel.com:jannh@google.com::mhocko@suse.com:mm-commits@vger.kernel.org:richardw.yang@linux.intel.com:rppt@linux.ibm.com:steve.capper@arm.com:tiny.windzz@gmail.com:torvalds@linux-foundation.org:walken@google.com:will@kernel.org,RULES_HIT:41:355:379:800:960:967:973:988:989:1260:1263:1345:1381:1431:1437:1534:1542:1711:1730:1747:1777:1792:1801:2393:2525:2559:2563:2682:2685:2692:2693:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3354:3865:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4605:5007:6117:6119:6261:6653:6737:7514:7576:7903:8599:8784:9025:9121:9149:9545:10004:10913:11026:11233:11658:11914:12043:12048:12295:12297:12517:12519:12555:12679:12783:12986:14096:14181:14721:14849:21080:21451:21627:21939,0,RBL:err or,Cache X-HE-Tag: lace81_4312809a3981e X-Filterd-Recvd-Size: 4206 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Sun, 1 Dec 2019 01:57:40 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DC62208E4; Sun, 1 Dec 2019 01:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575165460; bh=9BZUYEqPfJabm0sXj7iT6KNitd/1eNtHYRGahbxfQ3w=; h=Date:From:To:Subject:From; b=q1zajdH+WZx8wm883tzqsRPpDEDhzLji1YWtg3dhuGerCK8lFI1wUnosRhMSkf+PR LA9t0O2zVRqsCCZqzss3usrfRZoflCGOzNVMEcklmNEFwoDlTku3XNmR/yY7Tl6pDv 7bpnA54q1e6AeFhDBT56QZVxzpW+QmGK0t+balJw= Date: Sat, 30 Nov 2019 17:57:39 -0800 From: akpm@linux-foundation.org To: aarcange@redhat.com, akpm@linux-foundation.org, catalin.marinas@arm.com, darrick.wong@oracle.com, dave.hansen@linux.intel.com, jannh@google.com, linux-mm@kvack.org, mhocko@suse.com, mm-commits@vger.kernel.org, richardw.yang@linux.intel.com, rppt@linux.ibm.com, steve.capper@arm.com, tiny.windzz@gmail.com, torvalds@linux-foundation.org, walken@google.com, will@kernel.org Subject: [patch 142/158] mm/mmap.c: make vma_merge() comment more easy to understand Message-ID: <20191201015739.gU8SfaYW2%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Wei Yang Subject: mm/mmap.c: make vma_merge() comment more easy to understand Case 1/6, 2/7 and 3/8 have the same pattern and we handle them in the same logic. Rearrange the comment to make it a little easy for audience to understand. Link: http://lkml.kernel.org/r/20191030012445.16944-1-richardw.yang@linux.intel.com Signed-off-by: Wei Yang Cc: Mike Rapoport Cc: Will Deacon Cc: Michal Hocko Cc: Catalin Marinas Cc: Andrea Arcangeli Cc: Jann Horn Cc: Darrick J. Wong Cc: Steve Capper Cc: Michel Lespinasse Cc: Dave Hansen Cc: Yangtao Li Signed-off-by: Andrew Morton --- mm/mmap.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) --- a/mm/mmap.c~mm-mmapc-make-vma_merge-comment-more-easy-to-understand +++ a/mm/mmap.c @@ -1091,15 +1091,18 @@ can_vma_merge_after(struct vm_area_struc * the area passed down from mprotect_fixup, never extending beyond one * vma, PPPPPP is the prev vma specified, and NNNNNN the next vma after: * - * AAAA AAAA AAAA AAAA - * PPPPPPNNNNNN PPPPPPNNNNNN PPPPPPNNNNNN PPPPNNNNXXXX - * cannot merge might become might become might become - * PPNNNNNNNNNN PPPPPPPPPPNN PPPPPPPPPPPP 6 or - * mmap, brk or case 4 below case 5 below PPPPPPPPXXXX 7 or - * mremap move: PPPPXXXXXXXX 8 - * AAAA - * PPPP NNNN PPPPPPPPPPPP PPPPPPPPNNNN PPPPNNNNNNNN - * might become case 1 below case 2 below case 3 below + * AAAA AAAA AAAA + * PPPPPPNNNNNN PPPPPPNNNNNN PPPPPPNNNNNN + * cannot merge might become might become + * PPNNNNNNNNNN PPPPPPPPPPNN + * mmap, brk or case 4 below case 5 below + * mremap move: + * AAAA AAAA + * PPPP NNNN PPPPNNNNXXXX + * might become might become + * PPPPPPPPPPPP 1 or PPPPPPPPPPPP 6 or + * PPPPPPPPNNNN 2 or PPPPPPPPXXXX 7 or + * PPPPNNNNNNNN 3 PPPPXXXXXXXX 8 * * It is important for case 8 that the vma NNNN overlapping the * region AAAA is never going to extended over XXXX. Instead XXXX must