Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp227116rdb; Mon, 22 Jan 2024 18:54:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7JsuGTDCPwm+q1N48ibvwmDwJgmY7YgVm0XVSb+ecJjKe9ErbDQkHWnJjNniw3ZayXS3W X-Received: by 2002:a05:6830:84c:b0:6dc:30d1:9ae0 with SMTP id g12-20020a056830084c00b006dc30d19ae0mr5287523ott.31.1705978477406; Mon, 22 Jan 2024 18:54:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705978477; cv=pass; d=google.com; s=arc-20160816; b=lKe5ykeHrNe2s8xenhlC3RXza6kINIwOvMgO7jqiDAvaLDBJcpB1QNEISq3Gdln90W Fgs2QxSSrixvgCpLcr1elyT+blXiZShNfjlpsx0LSHEbo4IjtryzZnrtfRyBsFWoxppB VavZ0T6sEZYe9X//XHTmPkZOTz3rt4yInpnc7lLFaSqmuD9CJATcfNPtStfeaTNwQMO4 Vl78UL57MSToysyeMcNc/0t+c7zvO1tgl0xP6uf8/Jd1fBD4CkUGnAADWtH+yt1S3pNo b0LF7rEXEosOYBJEegGYnEb0hhiGBIkmo3a9ggI4LnHS7GR1npNq8Bwhq31qCbZRIJ82 voBA== 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=Fy9JI9s5CgHc9vU6scmFm3fgR9U6bOckIRvEe1L/hPs=; fh=RcGGX+iP8pM+QoPr7sPzvGliyrLu0BMDjpo18Y8ay5g=; b=CF1xsXEuSE+cVitOaptXhoW/Ppt6ulX2AwaEVx2pnCZI9gqI7TBGbtTBqaLbuj91fa Ys4I9T+1QydjZZQlOAs3eOMtGSr7kQS64+4RiQv5XXAphH8TLSDTmFhPWodH2VFEauJb S/3OmUBIKNMUQttelxd8LcrbUe7cmlkchXifkM+zF0EQOEWXC563DSCIVwED2vJRK9Ou BepUyMc3alLH9MqWD3R7vmoHoJrQmueMgs1BlDpECcqgTrUA3lFOvG47Gibw7WxvojEw u/ncQGLyiclc2ixTaKh6Dkr7l4nYmy6xBMFX2Dzv0YdyaJCrXv3NaapZ3eOT34wlK27D 5gDA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=GRBybsmf; 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-34631-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n1-20020a634d41000000b005ce07907cb2si8931560pgl.422.2024.01.22.18.54.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 18:54:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34631-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=GRBybsmf; 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-34631-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34631-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F33FE292453 for ; Tue, 23 Jan 2024 02:41:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F4E5EAF5; Tue, 23 Jan 2024 02:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="GRBybsmf" Received: from out-175.mta1.migadu.com (out-175.mta1.migadu.com [95.215.58.175]) (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 691CD525A for ; Tue, 23 Jan 2024 02:23:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705976604; cv=none; b=dzj3BvzNDNaIeU1FocyaFX04tFMHjMfGVU6NtFVgwaztNAKxeWASPFcODGOSdHjtkN2l+OOLeWFjGAY40RyRzVl/Ek5Np1Prre8zy5lj01df9TNT7jp+K/Vm8mXGvkz6ApUBiJdYK7UJPAfR1E8BzEyhNeoL2ENKs6OHQDShSmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705976604; c=relaxed/simple; bh=O3GX1nlYcs0zSCd7nC1/5Xu01YhkOecXq9lefI4hJyo=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=tEW5YbkBnmo6wnjLRSMQ9ODOrAAv597VRB/8yeJ4JyZz5dJoELZ3OJ3exem/UZfU/9zA6hrgpEYtdnywnK6R1rWBtQCTktZtxvKhkONHlWi4MHuUFTvLvVJQ1Gei03DvO+jFpoksgJXZvkJpgLh1avhBXKh/bV82WS+8B5pzPZc= 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=GRBybsmf; arc=none smtp.client-ip=95.215.58.175 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: <2a1d6a9b-f486-44c8-6d1d-e6bab4dc3ced@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705976600; 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=Fy9JI9s5CgHc9vU6scmFm3fgR9U6bOckIRvEe1L/hPs=; b=GRBybsmfuXKfd/mLRS+wIrZFlZhpe5WRZDKnbLkyNE08NsBjmFBbwFh81efoeyV1P1WVoU 6v4Wtv83tk6Q9yBSGWM4QQd0AFwYf6FQL8TQguA0eKL0vRpmzSPfJrxMlNqbBgsid1RAfm rVJdEY1UzcYcbLOjMvO++uDDfQGi4pk= Date: Tue, 23 Jan 2024 10:23:14 +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> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng In-Reply-To: <20240123001830.glqdmrv2qc56zfpc@revolver> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT 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. >>> 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(). >> > 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. >