Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp241827rdb; Mon, 22 Jan 2024 19:41:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEw4L2Cfix1TiMZYhfrTCC0su5Q4WCqLjQEcRmIRD17KU/QcdjG6KLcG7hZOg5Ka4wZhYVy X-Received: by 2002:a05:622a:144d:b0:42a:3c35:c054 with SMTP id v13-20020a05622a144d00b0042a3c35c054mr402218qtx.52.1705981299123; Mon, 22 Jan 2024 19:41:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705981299; cv=pass; d=google.com; s=arc-20160816; b=tJidKwf86mv1WEzvvo7tNv83Q0awx+ykAzkOJIAlqrofC8udr1afXvRXiwoJGOLL0j 2jW+FXpntnsxn3X13FgAVf5Crc1xm0MxOgS4iMWxJusIzinUwyA5jhBNlpTcz6qhF6Ul hRQON2wFasEBeRgEOipamlifcL3Ezi/1/i1hlxsDerYG0efWi5q1eDbw2osoHorwnM8M o2PBy88BQYw2JOvNgTUpESSBRriyk1Hxlj6seCm/GJC31xns/e4OtpBbiL/zPw9ThSnQ gci9qlAfIvcyketjRTqAQb4GdeVQdGKrP7Uq7iZXGYQLuQn3JaZTxVzRV7IWeyx2L1jf 1Itg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=Yt3AR0W7SP2tLShyq/3MhllgHeKq9WrP4nJ6WWve3yg=; fh=RcGGX+iP8pM+QoPr7sPzvGliyrLu0BMDjpo18Y8ay5g=; b=guM3LH3YdHk39HilM7u6k5ROzmDrkfE//v5xrrA3eyXLG7F3wR1AYipfIWrsi7ROMe AcSINVivrFTH14dxpa/gXaq0sybnp4lnhToYC/f4Siju8xWqqMzqEhuZtb5j01f05P5T 7izrgN/d7R/V7xGrFooAGL1A/vgNsc/wbeTUPFBWdPZZJKG9XdLhqw/khdcXN1TZxr3q ub/dLAhlEVy9VCDJrweykNnqqIcxUjIfJTBoizyijtPpML/3y32jaNAETI5Z19u9oAPX TAcHEVXJbw/3kk+Gdhqv+TGJtoURl8hn3Q/PxYdJWsAJBKhRCH7YOoLhbqDHLFSg7SGk u2Kg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=e4MVPVKA; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-34683-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34683-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i2-20020ac85c02000000b0042a2f5563a2si6983655qti.466.2024.01.22.19.41.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 19:41:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34683-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=e4MVPVKA; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-34683-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34683-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C93571C25877 for ; Tue, 23 Jan 2024 03:41:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAEE91846; Tue, 23 Jan 2024 03:41:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="e4MVPVKA" Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBADA110A for ; Tue, 23 Jan 2024 03:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705981291; cv=none; b=FjC13Cxthmymu+1daPZehGxQ9OXadJUoa6gIq29ygKD+sQJn6w8DylcqofxQTEjz4IySziZFn8BhaWrSzV6zmf9XF1uQtACKDzZ1nSZFXbZUrWccOaednGqTb2dBQYhh5wpU5EWE5ugDNVY4L1wZIBuDFjcbNwcos3sxpfVvGdI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705981291; c=relaxed/simple; bh=Ig2RP/uw0YQwueq8TUo7iEgZya+f3pXFj+GEGBrXvpM=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=M89AwdGCrS8WBM0gNxWRlE9QQaaaZg5xx8/CKELaops6TTQQubDmHIg1ohmnJHaDqamUm6Gwt9Se770F+HU26JoRkPOoCTkZPD6mwrm0qV0VFTCAIlfW4M5666Pu+h57xtair1RJ54WFJUhATcLPUAaoXCjSeBkq9DXlK58n7MA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=e4MVPVKA; arc=none smtp.client-ip=95.215.58.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <11da8b32-9946-9f7c-95fe-f6254b4f6e99@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705981287; h=from:from: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; bh=Yt3AR0W7SP2tLShyq/3MhllgHeKq9WrP4nJ6WWve3yg=; b=e4MVPVKA49CpZDs0C9I8EVqSiZTtfNWwjMCyOE54+2oirnjVE8J0e0vX3mo6iDnZS9Uhik 0XYRyGma4KiRE+Si6AaTpFK3viNajkr9Hmk5WmlIpFSYVvGbFcmrnKmc55cr1IVdfDwTUz R0A2LC1vw4WJwn8P/KEQvqiD9k9+4/o= Date: Tue, 23 Jan 2024 11:41:21 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] mm/mmap: introduce vma_range_init() Content-Language: en-US To: "Liam R. Howlett" , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240111021526.3461825-1-yajun.deng@linux.dev> <20240122220031.pwiravglee7o7k34@revolver> <20240122154031.b710f834b14d9027176f439a@linux-foundation.org> <20240123001830.glqdmrv2qc56zfpc@revolver> <2a1d6a9b-f486-44c8-6d1d-e6bab4dc3ced@linux.dev> <20240123031906.pwbjuzdpl6hqiptj@revolver> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng In-Reply-To: <20240123031906.pwbjuzdpl6hqiptj@revolver> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2024/1/23 11:19, Liam R. Howlett wrote: > * Yajun Deng [240122 21:23]: >> On 2024/1/23 08:18, Liam R. Howlett wrote: >>> * Andrew Morton [240122 18:40]: >>>> On Mon, 22 Jan 2024 17:00:31 -0500 "Liam R. Howlett" wrote: >>>> >>>>> * Yajun Deng [240110 21:15]: >>>>>> There is a lot of code needs to set the range of vma, introduce >>>>>> vma_range_init() to initialize the range of vma. >>>>>> >>>>>> Signed-off-by: Yajun Deng >>>>>> --- >>>>>> include/linux/mm.h | 9 +++++++++ >>>>>> mm/mmap.c | 29 +++++++---------------------- >>>>>> 2 files changed, 16 insertions(+), 22 deletions(-) >>>>> This isn't a whole lot of code, are there others? We're losing code >>>>> clarity in favour of saving 6 lines? >>>>> >>>> Oh. I thought it was a nice cleanup which made things more clear. >>> I'm not totally against it; that's why I suggested the changes below. I >>> think a name change would go a long way for clarity. It's not as much as >>> I though it would be though. >>> >>>>>> diff --git a/include/linux/mm.h b/include/linux/mm.h >>>>>> index f5a97dec5169..abb4534be3cc 100644 >>>>>> --- a/include/linux/mm.h >>>>>> +++ b/include/linux/mm.h >>>>>> @@ -3516,6 +3516,15 @@ static inline bool range_in_vma(struct vm_area_struct *vma, >>>>>> return (vma && vma->vm_start <= start && end <= vma->vm_end); >>>>>> } >>>>>> +static inline void vma_range_init(struct vm_area_struct *vma, >>>>> Any reason this can't be in mm/internal.h ? >>>> That would be good. >>> One other thing, do we trust this to be inlined correctly by the >>> compiler or should this be __always_inline? I'd expect it to be okay as >>> it is, but I've been proven wrong in a perf trace before.. >>> >> Okay, I would take __always_inline and put it in mm/internal.h in v2. > I'm not confident in this suggestion as the rest. > Please rename the function when you move it. inline is a suggestion, __always_inline is mandatory. I think __always_inline is better if we're demanding. >>>>> vma_range_set(), vma_set_range(), or just vma_range() might be a better >>>>> name? My thinking is that some of these are actually modifying the vma >>>>> and not just initializing it, right? >>>> I'd vote for vma_set_range(). > ^ This part, use vma_set_range() please. Okay. By the way, I sent another patch with ("mm/mmap: simplify vma_merge()") subject a few days ago. Please comment if you would like. >>> Using vma_set_range() leaves vma_range() or vma_size(), which could be >>> added for the calculations of vma->vm_end - vma->vm_start. Davidlohr >>> suggested such a beast a few years ago, but that one would need to live >>> in the include/linux/mm.h as it occurs a lot more. >>> >>> $ git grep "vma->vm_end - vma->vm_start" | wc -l >>> 198 >>> >>> .. for just those named vma. >>>