Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp10874pxv; Wed, 21 Jul 2021 14:03:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKSJelFZlc15CriRMLnQXq8/0RRs5a4eX6/WxnRqy8hspGm6DZLZovdH/LbRD1vUYyWhTk X-Received: by 2002:a92:b506:: with SMTP id f6mr20243882ile.151.1626901433443; Wed, 21 Jul 2021 14:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626901433; cv=none; d=google.com; s=arc-20160816; b=Z9VtBjBk5z7nSKKWXr7jrXpWKteQob8WEG3wEMfpabteZIl1Yt47sOSJg6E6v5FXx1 q3qMn08PDJXB2iTfz9ofh8S6FduiuFf2KdgmweCX+OUmBu9RR0+/Lp6wXDHs1ushBEQn 6ZuQmDEwpU2ERHmOr/UY9f7JJX/yGk0yhMQaBUkkg2I7joSmZTxk20vGF+4NeiTxfJ3C SqqSuBmMRXjcEpRCslf1HxX8cmdwLYbHw7CSeBFu/LY3/VWhnCy3UD2xKSyO/ax6yQHm JXSNOHvd/6EyiJr3A2qYDPlaCD9crzV9rP4AOnuYghIYyw8ZtZK7UjPX1EoGE+Om3pKz Zb5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tOE3NPRB7X+kOfCSnwgM1RAUX3A4OJ/1KLMM54dafzU=; b=BNXpJJJMIGBIm4tnXBJWgZnirxHlkViO5p/3rqNU1SxIELjfQUTR5tdqCm6KwSTnPm wAqJ5q3jmvl63eT9aCDdrIL6FmhnG8Bu+RF9cDoUytn0H5+rQzOAILcl7IdMZNHMwtxT Y+ygBbScUoGNZnfLh/0uNmfZ0JsQho3XPIBfSz/t+9QJUYo1PTxlFYxElzz9froGsZPN vOXJSSh5u5pGlqMdJinF5u0ZmViiWUz/ZsBQX8lYOLN9ndtfWgBTu9tEDfi0xYjb8zkF lsr1nWHQNXlxsIIsCr/JecE5Tltj67Bg7Rn2o//UFGnLPJRGPOwp4twx3zzhqAekw6Je SWHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vll2DpaS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p6si1902085ilp.141.2021.07.21.14.03.41; Wed, 21 Jul 2021 14:03:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vll2DpaS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239869AbhGUOxg (ORCPT + 99 others); Wed, 21 Jul 2021 10:53:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239819AbhGUOxe (ORCPT ); Wed, 21 Jul 2021 10:53:34 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2F06C061757 for ; Wed, 21 Jul 2021 08:34:08 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id x192so3816007ybe.6 for ; Wed, 21 Jul 2021 08:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tOE3NPRB7X+kOfCSnwgM1RAUX3A4OJ/1KLMM54dafzU=; b=vll2DpaSlntmS7LILP0YtMfKDyAnqJL2dlBVgLqgMHk6eZkoMY6Ewx06Vv73253V0+ EiC0sLFG4nJibo2AQyD5kcA8Ca8FL7EKVKLPgxnVa6lGCrI53j4zeXIoCEwOjsL5ZpLp 4g/aKw3zN3BLMelpjGCbtHlT2gPNNfPPfgNcJn8IKK8nfE1ZlbimXiWiRCrXCqHmyeN/ Iw76LTIJ8rFYtVcuUNkDpfR2GO/k14MilQCvqg+vQRpNSWxQ/k6Q26NGHwwrD0ogaP9T hccwChHYLDuXRVWtyvzBAYGTs6dVMF1ty2zVlDgR1HUSGI8aOQzMWgLddDTXl5NgxbHN CG8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tOE3NPRB7X+kOfCSnwgM1RAUX3A4OJ/1KLMM54dafzU=; b=qdbLXv9QOdhY/AayvJ1hJ85ujkMA8+AmpGcjcdPbBvhGCLV6ypv/Bukr+DXDt0zj9j 4pB5bcoJkGRxy35JCrTWS7OsOzguu7AClp572JiuCQZa+U4yjZWgcYHiRVDTE0qWojGm 4bvDjKk3MbXci5tmqMoTnpxgk0zhHFjLRO/U0kXNtnBxJZcLZ43bhczhD0fRYaK4y8p5 Gdkm4m4H6uT08t2I1aZeDNYu1oQm2YYjqbflYKxz9JEhx95cCkNLAY3E80QLmUw2hVxc JFwDHPgUKEc0jk3+SmObq73LiXmkSManqKigyXLW3uD3bdynjE0Hmw+9YyqPhVqgox3A LKCQ== X-Gm-Message-State: AOAM530Y1yRsfVNuN1yJtISqD6acQNClMjKRQYbnqL0p4JMPA+SB6lbK 7ADjNd98Q2WOBNZVdQ19UsXXJn57IyGeBzTkkKYoTg== X-Received: by 2002:a25:2e49:: with SMTP id b9mr48225098ybn.250.1626881647614; Wed, 21 Jul 2021 08:34:07 -0700 (PDT) MIME-Version: 1.0 References: <20210718214134.2619099-1-surenb@google.com> <7eb17da6-03a6-5eaf-16e6-97b53ba163d8@redhat.com> <20210720160707.2332738708948f7d865d67c1@linux-foundation.org> In-Reply-To: From: Suren Baghdasaryan Date: Wed, 21 Jul 2021 08:33:56 -0700 Message-ID: Subject: Re: [PATCH v2 1/3] mm, oom: move task_will_free_mem up in the file to be used in process_mrelease To: David Hildenbrand Cc: Andrew Morton , Michal Hocko , Michal Hocko , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Minchan Kim , Christian Brauner , Christoph Hellwig , Oleg Nesterov , Jann Horn , Shakeel Butt , Andy Lutomirski , Christian Brauner , Florian Weimer , Jan Engelhardt , Tim Murray , Linux API , linux-mm , LKML , kernel-team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 21, 2021 at 12:30 AM David Hildenbrand wrote: > > On 21.07.21 01:07, Andrew Morton wrote: > > On Tue, 20 Jul 2021 14:43:52 +0200 David Hildenbrand wrote: > > > >> On 18.07.21 23:41, Suren Baghdasaryan wrote: > >>> process_mrelease needs to be added in the CONFIG_MMU-dependent block which > >>> comes before __task_will_free_mem and task_will_free_mem. Move these > >>> functions before this block so that new process_mrelease syscall can use > >>> them. > >>> > >>> Signed-off-by: Suren Baghdasaryan > >>> --- > >>> changes in v2: > >>> - Fixed build error when CONFIG_MMU=n, reported by kernel test robot. This > >>> required moving task_will_free_mem implemented in the first patch > >>> - Renamed process_reap to process_mrelease, per majority of votes > >>> - Replaced "dying process" with "process which was sent a SIGKILL signal" in > >>> the manual page text, per Florian Weimer > >>> - Added ERRORS section in the manual page text > >>> - Resolved conflicts in syscall numbers caused by the new memfd_secret syscall > >>> - Separated boilerplate code wiring-up the new syscall into a separate patch > >>> to facilitate the review process > >>> > >>> mm/oom_kill.c | 150 +++++++++++++++++++++++++------------------------- > >>> 1 file changed, 75 insertions(+), 75 deletions(-) > >> > >> TBH, I really dislike this move as it makes git blame a lot harder with > >> any real benefit. > >> > >> Can't you just use prototypes to avoid the move for now in patch #2? > >> > >> static bool task_will_free_mem(struct task_struct *task); > > > > This change makes the code better - it's silly to be adding forward > > declarations just because the functions are in the wrong place. > > I'd really love to learn what "better" here means and if it's rather > subjective. When it comes to navigating the code, we do have established > tools for that (ctags), and personally I couldn't care less where > exactly in a file the code is located. > > Sure, ending up with a forward-declaration for every function might not > be what we want ;) > > > > > If that messes up git-blame then let's come up with better tooling > > rather than suffering poorer kernel code because the tools aren't doing > > what we want of them. Surely? > > I don't agree that what we get is "poorer kernel code" in this very > instance; I can understand that we avoid forward-declarations when > moving smallish functions. But moving two functions with 75 LOC is a bit > too much for my taste at least -- speaking as someone who cares about > easy backports and git-blame. There is a third alternative here to have process_mrelease() at the end of the file with its own #ifdef CONFIG_MMU block, maybe even embedded in the function like this: int process_mrelease(int pidfd, unsigned int flags) { #ifdef CONFIG_MMU ... #else return ENOSYS; #endif } This would not require moving other functions. Would that be better than the current approach or the forward declaration? > > Anyhow, just my 2 cents. > > -- > Thanks, > > David / dhildenb > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >