From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EEE141EE002 for ; Thu, 17 Oct 2024 21:08:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729199295; cv=none; b=T2Cqsarbchq/0kgarRbEp9RaCDbUTvQloqbbmXv02BME4rMe1IRXhjhQa43m4nRbJo3c4Dt0sqCFfxcw5bfWVOeNKgDWeQWlHFB/LOH3/C7jpHKau0yXJqEpZbjAkwAZiHbj5FKYMoTfTlz+Ymmvd/qioaoEzqY7+T0lIw19/I0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729199295; c=relaxed/simple; bh=ZuuN+2bvokfFHmLl4MuEabN0US1Th7GC0dpGBGVvyio=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=TRMGrxhjBn7RFeqVYS31lwXoieODHbWdEGV84wXOq9Rf2scLl+VGCFFoo068wrbUtPijH+0qEtyjpRKAirFtnPQxM0XpX6UvKo0F2BgYJz7xTUvfybZ2cBCTyKDxuWMDiTFvcddgeWdQElVeFrgvJnuIyZE7eaMq/7bBK1IQiZc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=Rlo0+Rhz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Rlo0+Rhz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DD27C4CEC3; Thu, 17 Oct 2024 21:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1729199294; bh=ZuuN+2bvokfFHmLl4MuEabN0US1Th7GC0dpGBGVvyio=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Rlo0+RhzRlEBqivcUdgCxS+YHhstPpDiza/dZOS+DHsDH9S6tml3AjfiTNapUT0LD dl8T7ugnXrduJzjjqHXncSkh03bKoxEpmxdFAH/V7mG4nNjLsfWDl+UzX6IYGUhfzl kadt9pG0ClTio+RuG4cf8vNNCcYVpDQhgy/SDfoM= Date: Thu, 17 Oct 2024 14:08:13 -0700 From: Andrew Morton To: Jeff Xu Cc: "Liam R. Howlett" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lorenzo Stoakes , Jann Horn , David Hildenbrand , Qi Zheng , Kefeng Wang , Pedro Falcato Subject: Re: [PATCH 1/2] mm/mremap: Clean up vma_to_resize() Message-Id: <20241017140813.fe555ec947b17dd035e4c0d7@linux-foundation.org> In-Reply-To: References: <20241016201719.2449143-1-Liam.Howlett@oracle.com> <20241016201719.2449143-2-Liam.Howlett@oracle.com> <4izjonpaqhkx6p3csfyxcjicgqahbmj2k6gupazehb3l7xhnvi@twlvpx2wc6ce> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 17 Oct 2024 11:15:20 -0700 Jeff Xu wrote: > > > > -static struct vm_area_struct *vma_to_resize(unsigned long addr, > > > > +static int mremap_vma_check(struct vm_area_struct *vma, unsigned long 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. Any function with "check" in the name makes my teeth ache. "check" what? And the name doesn't carry any connotation of the return value's meaning. eg, "check_the_cheese()" versus "cheese_is_fresh()". The latter name tells you what is being checked and it tells you what a "true" return value means. Also, the dang function isn't documented. Also, why is mremap_to() calling mremap_vma_check() without testing its return value? mremap_vma_check() doesn't actually alter anything, does it? If it does then it's misnamed.