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 5AE64D3C526 for ; Thu, 17 Oct 2024 18:15:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFE296B0083; Thu, 17 Oct 2024 14:15:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D87736B0085; Thu, 17 Oct 2024 14:15:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C287F6B0088; Thu, 17 Oct 2024 14:15:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9C45B6B0083 for ; Thu, 17 Oct 2024 14:15:35 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 23168AC6A5 for ; Thu, 17 Oct 2024 18:15:13 +0000 (UTC) X-FDA: 82683896736.30.C7A6E63 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) by imf06.hostedemail.com (Postfix) with ESMTP id 0E60518000C for ; Thu, 17 Oct 2024 18:15:25 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="c2/9TuNl"; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf06.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.160.44 as permitted sender) smtp.mailfrom=jeffxu@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729188773; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DHjzV8GIFWQi9KufRK9CoYHfQ8GleMG3rIylN1btqcA=; b=f0ASJ0fn8jjnUjDhy8d1qio8a5FeQi233jNUrSqVAC+nlnkt1D36jJRiJD1zKyRxrh3O93 1PpvoAiODmBuyiAVmJsR0AQWm5q3L8Rg+jxYmKKfAN0tDNCFAlCM+crOlCB/lStY6U6clZ B4da7CRPJ7/zVI5VBEdLPCf6pcqBeb8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729188773; a=rsa-sha256; cv=none; b=YAi6JPjKunrzeYdjoE+iNfniLuYp2scWYOm105iYuav3vf8oMn//et/a4BK37eCmZ7jG/d bQxb4NZZeqmjW2aOPyFY+HYtXm82nS6jHowd9ACplDGWanRadDoCtO9bzHZSFsx2JV+H7i FUXwsxzjuGWo47qGAqo+x9qV9lT2nII= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="c2/9TuNl"; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf06.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.160.44 as permitted sender) smtp.mailfrom=jeffxu@chromium.org Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-2888bcc0f15so155721fac.0 for ; Thu, 17 Oct 2024 11:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729188932; x=1729793732; darn=kvack.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DHjzV8GIFWQi9KufRK9CoYHfQ8GleMG3rIylN1btqcA=; b=c2/9TuNlFrbmdGNKNIPiSYPrQ+VuH0TzYdaUzTl8hBNwMp14097rODDxh2foi3olHQ r7h1+JfqnGZWVwcnbtk1l4+A0nlmymkAgtjhsynfXKzICdrO9ntVbz4A1G/2eY4w/MOw N50K594c1Ht3Rr8HnjLo7nU+lw9ibO3dYGBM4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729188932; x=1729793732; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DHjzV8GIFWQi9KufRK9CoYHfQ8GleMG3rIylN1btqcA=; b=Kz8zy8yNEm8XJkyJgZN8jGpK3aoH+Y1VyQsfWFaws5GYGoNAUqHPrieLZ1dPRTNq+c J5m0zYGOQ6A+V9JYOt3E8LTgKjHnM30wQA4b+JM3VE4QZTBEIxVZyFLP7drp/ez5AJc0 MI4I9beZlt3aK0PVhNBzrWmQ6Ty/aTde1xxjf5MXBARHQXRyAdtYRvkhs4+FiIWVEc0L E0rtuKxITk/raP8EKJRMkja45nQIm20TpQ8bmozQrB58e4YELqxDCb/BePp3XOeAylsC /nbN4B7ZFAmAJHwe5opFBvr9HrnqRrKjalGXMBWgym1O52kcMoZhYS8wlp7JoeeoVwUW G3CQ== X-Forwarded-Encrypted: i=1; AJvYcCV6C0+ecrJrUC6DNmp8TTeOeA6/YfccUar0mlEowoxUbTVVH+lr/Ir/3isu1jUAFQPXijVx8qaqqg==@kvack.org X-Gm-Message-State: AOJu0Yzg3bEO7ojjOUly+jWw7CSp1fIFPrIfBaPKWesRjkzy5xLPGjr9 G5AVfGPWiu8KBclk6F3LN74eO65ff6gXcc/8Lk+8cu1FImOXrqrvreVdyZxE5Qz5w9Ijd344bLT QYF+r/A7XrstoTeCLqnhLqNTAQPLKuP0yk2fB X-Google-Smtp-Source: AGHT+IHWoSRydBwpFfvzHOj+pEJcPJy3O5dGMCE675ZY1tgLOWLdb19FSg2ahEsrWnglBoA4ppbBK8AjpwmRUGi7x1I= X-Received: by 2002:a05:6870:5253:b0:27b:9f8b:277c with SMTP id 586e51a60fabf-2890c7efecbmr1150009fac.11.1729188932453; Thu, 17 Oct 2024 11:15:32 -0700 (PDT) MIME-Version: 1.0 References: <20241016201719.2449143-1-Liam.Howlett@oracle.com> <20241016201719.2449143-2-Liam.Howlett@oracle.com> <4izjonpaqhkx6p3csfyxcjicgqahbmj2k6gupazehb3l7xhnvi@twlvpx2wc6ce> In-Reply-To: <4izjonpaqhkx6p3csfyxcjicgqahbmj2k6gupazehb3l7xhnvi@twlvpx2wc6ce> From: Jeff Xu Date: Thu, 17 Oct 2024 11:15:20 -0700 Message-ID: Subject: Re: [PATCH 1/2] mm/mremap: Clean up vma_to_resize() To: "Liam R. Howlett" , Jeff Xu , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lorenzo Stoakes , Jann Horn , David Hildenbrand , Qi Zheng , Kefeng Wang , Pedro Falcato Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0E60518000C X-Stat-Signature: 3wkead13px4m7biw8uywcoz73ax69db1 X-Rspam-User: X-HE-Tag: 1729188925-282255 X-HE-Meta: U2FsdGVkX19lLLtEjXPm6jlTmzh5ID8vGOB2kBHUPxmv1K2LOC0bdRYnNE/PEjvPmzre++AShPAT/hNXcOtM4OgpCnke/Cw/Bx4/pKN21KM/PNDGnz6tazZj2IQzQ1eXsEQX9S/l1vIRuvm1uD/ib6qKwiUCrlWddsKbio9UifUma/gEUaBMht1EWev1Rh221bBu46tNCk1wAl89IcgQ+NlHlQeSyhaLnUforUWJ13i0rdsbTMPJ9oaYRsHg9HBKyCQI0Q3MRMmiKihE0dgSdt6/NMSfY2hLaPdMo5yDZhwrOhGqMbRT/vXffbnE/Er/O4pqlHujOW91XmK1eSdQfZWOlTqqorZjvR8GsnaaAVQF5rK2InQGfAvKo6ZtiV/jokUb6ttKqqOeQW5J4akKGjdaSkD1GIZEUKgPoAzS9XSbFQrjBNsSOceODFhoYz46nHWIB71NI9A5z4YnPmbhEsvyKb1tlhL91KG0gdIW0InMs4AFAjjzrMh+CzLpfUqtl3J04zd9+xjEwxLtbnpdujMSWokv/1vx9eCuWb9aCBgb3qkfmDDsn9A/mv7Ec4oBe55yteoWh/jW1hmLKLWzh2YohlYkO4EQ+3EPfpHqDc/Yf1pkq56vyme7lA1snZUNcGXwV8gpqjD83jLWVscDKOxdzkYARpheQNSSuRog4mNXfa5SCtXFddPpWNvJSjOEQT4iXGZ2g+anH9TtDzY7STLY3klEgzl/p+tVcvLPTTQXYkkz46OlcySgDDJHnfNF4F/EC/bV2ZVJPlHh8wZyJ4phMzYbF6AR5HeRtTAGjXKoVGYGWkQkFlVO5lmkL2Tu1PG+hqmrW7MC4jn7qN6GJeVmXr5Efwfj5D3B3GYtoGKbTmjW9Cp5hVtbTbYLvvG4RJPproML8/hLAv/idXtGLSGB3I9hSfuDVuRA6G+4PlZ16iLi7QeCR8kzg0D5KCksvFlkGv1/yjgZ+Wtgo6B jb6xJOCv H2lndlvoDut93ThrV0oXI47fq2g7olvp34k9SXhzUZgXO1EpPubMCWGRaE+RoIVBJUzprFg6WWSOYEustWknlo/A+ewqzcDZiVp9uVx27XfCEPeFymNaCwK2fCl7sq+1ov0tN4ApAwl8A+0T2HArEoA1rKo7JlhlQuATABb9VkwIl3TsC2umAMsvSrLBEzIn6Cm3LTUgBDFgbFxB6hA7IO9rFBNy+NMc+HWClIRSq6s0nTo9pOHDb8YnulpWHuppxlkQzPCvYQo0fJJGenByVonhw8+sTtTGZXMEobBZRCF+FtHBpnlOUUgmov0ND6b3+4upL/0LppOxccfZU3QVaKoHhMYsYwj+WAUMbD/v4p+C+ReE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000059, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Oct 17, 2024 at 11:07=E2=80=AFAM Liam R. Howlett wrote: > > * Jeff Xu [241017 13:55]: > > On Wed, Oct 16, 2024 at 1:17=E2=80=AFPM Liam R. Howlett wrote: > > > > > > From: "Liam R. Howlett" > > > > > > vma_to_resize() is used in two locations to find and validate the vma > > > for the mremap location. One of the two locations already has the vm= a, > > > which is then re-found to validate the same vma. > > > > > > This code can be simplified by moving the vma_lookup() from > > > vma_to_resize() to mremap_to() and changing the return type to an int > > > error. > > > > > > Since the function now just validates the vma, the function is rename= d > > > to mremap_vma_check() to better reflect what it is doing. > > > > > > Signed-off-by: Liam R. Howlett > > > --- > > > mm/mremap.c | 39 +++++++++++++++++++-------------------- > > > 1 file changed, 19 insertions(+), 20 deletions(-) > > > > > > diff --git a/mm/mremap.c b/mm/mremap.c > > > index 5917feafe8cc..648c29f568af 100644 > > > --- a/mm/mremap.c > > > +++ b/mm/mremap.c > > > @@ -826,17 +826,12 @@ static unsigned long move_vma(struct vm_area_st= ruct *vma, > > > return new_addr; > > > } > > > > > > -static struct vm_area_struct *vma_to_resize(unsigned long addr, > > > +static int mremap_vma_check(struct vm_area_struct *vma, unsigned lon= g addr, > > The original function is vma_to_resize, and mremap_vma_check is > > missing this context. > > Maybe mremap_vma_check_resize is a better name ? > > Good point. That suggestion is long though. Perhaps > vma_check_resize(), since this is a static function in the mremap.c > file, it is fine to drop mremap from the name. > I'm ok with that. > ... > > Thanks, > Liam