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 X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97170C636C9 for ; Wed, 21 Jul 2021 15:34:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76A7361248 for ; Wed, 21 Jul 2021 15:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239903AbhGUOxi (ORCPT ); Wed, 21 Jul 2021 10:53:38 -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-Google-Smtp-Source: ABdhPJyyTCPunnRzKWFhKCFsefVcfi2KAxUStCwy/XNh/S1k9zdtFicTPgnjha+Im/baQZ6P245+qmjJfROyxCqPch8= 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. > 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 X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97443C12002 for ; Wed, 21 Jul 2021 15:34:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1B4E36124B for ; Wed, 21 Jul 2021 15:34:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B4E36124B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A85266B0081; Wed, 21 Jul 2021 11:34:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A35436B0083; Wed, 21 Jul 2021 11:34:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 924536B0085; Wed, 21 Jul 2021 11:34:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 792076B0081 for ; Wed, 21 Jul 2021 11:34:09 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1DAD622BE8 for ; Wed, 21 Jul 2021 15:34:09 +0000 (UTC) X-FDA: 78386991018.17.EF6B440 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf05.hostedemail.com (Postfix) with ESMTP id B9C3F5024117 for ; Wed, 21 Jul 2021 15:34:08 +0000 (UTC) Received: by mail-yb1-f182.google.com with SMTP id g5so3794923ybu.10 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=R3o2nXRW4NT7NvKVXEd12+ylxozdcSfg2gzDTceGatqZ63+zLYyjFXn+tJ5DR/iMSN 1FEi4ooi8RpoP+88U6dovwa7V8wICzIDrkthNeQvG2j1qOQZIIl+3AP57VDmow8shMfW conXs4wEx9VxGOBDjbMmO/8Ov4acKVyDnfEqB1EHD1RHj/M3P5rSet7sWYNl4z1bPdp0 O2bvz/rW/1iXob4k7rQ5WD5McSbN7+VjIdJ5ovtfPfVe7xAm+MM8VeVa+Z21ONgQZG9O MTKLHTdHsmamKuG5NwLoqU/q5EALZpXkuvF0KxJsaQqidpcmxk221o/ivbPd2OrlaopK XL6w== X-Gm-Message-State: AOAM531G4sYVXAECfVdAuaH9tqiw/i1bn5DxUhLT+GOKBYGOKdxbOYYN mOZJddM1OmL2mZlQ1OM9A9BAIJ38DOCyvrw1iPsTwg== X-Google-Smtp-Source: ABdhPJyyTCPunnRzKWFhKCFsefVcfi2KAxUStCwy/XNh/S1k9zdtFicTPgnjha+Im/baQZ6P245+qmjJfROyxCqPch8= 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" Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=vll2DpaS; spf=pass (imf05.hostedemail.com: domain of surenb@google.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 754okdezo57u7yue9iw9cq6kfccsyydq X-Rspamd-Queue-Id: B9C3F5024117 X-Rspamd-Server: rspam01 X-HE-Tag: 1626881648-604403 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. >