From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D104C433FE for ; Fri, 20 May 2022 15:52:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A23A66B0071; Fri, 20 May 2022 11:52:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D1F76B0072; Fri, 20 May 2022 11:52:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 874076B0073; Fri, 20 May 2022 11:52:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 78B346B0071 for ; Fri, 20 May 2022 11:52:53 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 48CA23518F for ; Fri, 20 May 2022 15:52:53 +0000 (UTC) X-FDA: 79486564626.19.C26DB82 Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) by imf20.hostedemail.com (Postfix) with ESMTP id A8C4B1C0007 for ; Fri, 20 May 2022 15:52:35 +0000 (UTC) Received: by mail-vk1-f175.google.com with SMTP id e7so4321011vkh.2 for ; Fri, 20 May 2022 08:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tpdW7ecTraKhRbFvsmKOuE6oFJXwO3YExgfPm1rem6k=; b=iwOJDaYD3rkoWkWTQttkxXrc7bmfCiBueluPS4MvM/SUBPn/XmWiUP4nfjxIyirEyy r40MMADjDftUxIlayYfIh11OWDcRYd18Kq2bj3FOAGjHxrLKBhtCz0a2hehKSPHs6+In G8/0QMpR9YchPdTTDcAxLCqL5/wpRXKv8FJrplu7Gn4hVlpy6ULxDxQja191vcQfz/9r z2Z2WKug9WpP4QL1E1spbNRTcu/HE/VIKnXJCTA76y73Z3vjsrpel6bEm6T0cidcBtY9 UgZTs9GoHMKRvSG+wcxwinB0aaJ3vUjdgHv+0G6E9FpiPS/aeMhIUPb4RJjE8Iy7Ausr i/Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tpdW7ecTraKhRbFvsmKOuE6oFJXwO3YExgfPm1rem6k=; b=DcotnaK2MLOGGfhocYCJZauqHp2QeMWTxYpcr5vY2ZRHZQL2YwEF0qnijk08Wk2iS/ p9roWtcvpJNhBHuBll0d1jPqtuufryNRX3KOnrSM21zfvd5unR+S736aioI1MfX0wwQr k6qdg3bT404XeydCyEb+N3zW6EbR5kOrN3ZYf1do1TXoB9nxh/SJPvlJePXdiQnh0t0M VdLQVkrIeNeASD6sWYwCAiChnoXpbiYd10lPvFuA5WnV6N6hf5RX4ihYuMOKaKvsJLd2 BK4v8STCcd7HoS89ViUN4OX9DIcgySnAqYaTuU+1M7ti7L6+Mfy/fd3OlBnws6TX2Nft EI+g== X-Gm-Message-State: AOAM532FqmRxDpUADWWePzdzbQmTEEt7hEqnCVHkqiEmF6s/jgWLUeSn qHSxYeePzGQNKCervlCrqVlGY/KGM7M5CJa3kP0= X-Google-Smtp-Source: ABdhPJzkmCYAR3lHsKWTR4WJw3EHqbOIe/Gee4gEL4BAfCHI1FQm8jmDahubi6kfWk7b2fsJlMHMycZJU/sHEFJaZww= X-Received: by 2002:a05:6122:1184:b0:356:f6f5:da0c with SMTP id x4-20020a056122118400b00356f6f5da0cmr4344329vkn.36.1653061968101; Fri, 20 May 2022 08:52:48 -0700 (PDT) MIME-Version: 1.0 References: <20220516125405.1675-1-matenajakub@gmail.com> <20220516125405.1675-2-matenajakub@gmail.com> <20220520132800.hijytnlyjqeesjfj@box.shutemov.name> In-Reply-To: <20220520132800.hijytnlyjqeesjfj@box.shutemov.name> From: =?UTF-8?Q?Jakub_Mat=C4=9Bna?= Date: Fri, 20 May 2022 17:52:56 +0200 Message-ID: Subject: Re: [RFC PATCH v3 1/6] [PATCH 1/6] mm: refactor of vma_merge() To: "Kirill A. Shutemov" Cc: linux-mm@kvack.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, Vlastimil Babka , mhocko@kernel.org, mgorman@techsingularity.net, willy@infradead.org, Liam Howlett , Hugh Dickins , riel@surriel.com, rostedt@goodmis.org, peterz@infradead.org, david@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: fo7dqkwurkgx45134zy8epir38jduwyh X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=iwOJDaYD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of matenajakub@gmail.com designates 209.85.221.175 as permitted sender) smtp.mailfrom=matenajakub@gmail.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A8C4B1C0007 X-HE-Tag: 1653061955-263393 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: On Fri, May 20, 2022 at 3:26 PM Kirill A. Shutemov w= rote: > > On Mon, May 16, 2022 at 02:54:00PM +0200, Jakub Mat=C4=9Bna wrote: > > Refactor vma_merge() to make it shorter, more understandable and > > suitable for tracing of successful merges that are made possible by > > following patches in the series. Main change is the elimination of code > > duplicity in the case of merge next check. This is done by first doing > > checks and caching the results before executing the merge itself. Exit > > paths are also unified. > > > > Signed-off-by: Jakub Mat=C4=9Bna > > Okay, this looks good: > > Acked-by: Kirill A. Shutemov > > I would also consider renaming 'area' to 'vma'. 'area' feels wrong to me, > but maybe it is only me. Well, the 'area' is taken from the original code and the name is not the only thing wrong about it. It is actually used for two purposes, which is definitely wrong. First purpose is to store the middle VMA between prev and next for the use of case 8. And the second purpose is to store the resulting VMA which is passed to khugepaged_enter_vma_merge() and also the return value of vma_merge(). So, to me it seems that the best approach is to split it into two variables 'mid' for the first purpose and 'res' for the second one. > > -- > Kirill A. Shutemov