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 20FFCC6377C for ; Wed, 21 Jul 2021 20:19:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A0376100C for ; Wed, 21 Jul 2021 20:19:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232681AbhGUTjN (ORCPT ); Wed, 21 Jul 2021 15:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbhGUTjM (ORCPT ); Wed, 21 Jul 2021 15:39:12 -0400 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB2CFC061757 for ; Wed, 21 Jul 2021 13:19:47 -0700 (PDT) Received: by mail-yb1-xb2a.google.com with SMTP id p22so4998957yba.7 for ; Wed, 21 Jul 2021 13:19:47 -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=xkz8e5zoLl+P/xUlIkmPyH45rVLINuttESNxvxpX8Aw=; b=mkhSJH5Yhy9xgGZWWTzQK3DU7fOimBnomF7BAoS4IX/VY4PIqsb/NJCEdkVcZi0xZr SDKETen7hW9gU9RX1zFKjWYS06prWY5uy2QxLyCS0jsjkSJYmuntjg7SpB4N0ckkXlqb LVJef5RdBJ32sTsFue1OUwRae/EolE3XZAnQ2+XxWVPIh7/OOh1dRjbXd4ZESa4LZ2Eo QAPhsVXsj5a3dPbPo24528AN/wyavMn/guI8mAxz7Py3+9YM94KZY16BNQReg2cCIGEr HJ6HA6J7Y7BYQL5JoL86dK0G6lvBjBh1GjbojighOM90a6VIngUgRGdR7NpCV7dDFNFs HwhQ== 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=xkz8e5zoLl+P/xUlIkmPyH45rVLINuttESNxvxpX8Aw=; b=M5M1OQ0eGlShnif6LzxW1yg9dpZJCzn1hPC1e1N59uWeQFL8MCtEwyHQvAdhEJUdZL CSOA9t3UnkWDvkM+fPVwBv9t4Cgx3wiQdlodwmq2gcrgCa1W6Wf/cr3p/f5FcR3myX/B WOIfjR9n5vCQwn0GMe3N7/seIJk+z/JUqmvfzHuuWUgoiWsP99L5rv/02LS06G+A4Vb9 qalmvZvRlCLhDUAyrdgYV+OzbZpxWHs7AAGmsjapszvPfmSMrhokwgCoYOjGAe6O6ygR h29zeynE+PbD/49gavibfO8aRySgUG5r2hxuGrPRbpdaKG1Uu/l6VctAHbtYw8T1kGpq ZvgQ== X-Gm-Message-State: AOAM530Q1cXqi/XJybjIlM3Hui+surdxqSN6Ja21yO6+o4EzG8qkGaJD xYDwIRWbzyUGAG8ZzlVTyFc8/K3UoPH6OyG8hDh1MA== X-Google-Smtp-Source: ABdhPJypFChcBkzFoquthKjD/24AdEw1F2MgJ9qToLmo3bIsOhEjDYJRxwCKXDd+h8fBIXpz3mR3FPRLVJtQ0pLXrB8= X-Received: by 2002:a25:ba08:: with SMTP id t8mr47509822ybg.111.1626898786723; Wed, 21 Jul 2021 13:19:46 -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> <0ee6775b-589c-3243-1c01-aafad5eecb73@redhat.com> In-Reply-To: <0ee6775b-589c-3243-1c01-aafad5eecb73@redhat.com> From: Suren Baghdasaryan Date: Wed, 21 Jul 2021 13:19:35 -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 9:13 AM David Hildenbrand wrote: > > On 21.07.21 17:33, Suren Baghdasaryan wrote: > > 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? > > IMHO that could be an easy, possible alternative. Andrew, others? Should I follow this path instead? > > -- > 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 4BFC9C6377B for ; Wed, 21 Jul 2021 20:19:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E428C60FF4 for ; Wed, 21 Jul 2021 20:19:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E428C60FF4 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 748706B006C; Wed, 21 Jul 2021 16:19:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F8116B0070; Wed, 21 Jul 2021 16:19:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E7406B0071; Wed, 21 Jul 2021 16:19:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id 430556B006C for ; Wed, 21 Jul 2021 16:19:48 -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 061102705B for ; Wed, 21 Jul 2021 20:19:48 +0000 (UTC) X-FDA: 78387710856.17.F0E8E9D Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf30.hostedemail.com (Postfix) with ESMTP id B17A5E0085CA for ; Wed, 21 Jul 2021 20:19:47 +0000 (UTC) Received: by mail-yb1-f172.google.com with SMTP id k184so4947803ybf.12 for ; Wed, 21 Jul 2021 13:19:47 -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=xkz8e5zoLl+P/xUlIkmPyH45rVLINuttESNxvxpX8Aw=; b=mkhSJH5Yhy9xgGZWWTzQK3DU7fOimBnomF7BAoS4IX/VY4PIqsb/NJCEdkVcZi0xZr SDKETen7hW9gU9RX1zFKjWYS06prWY5uy2QxLyCS0jsjkSJYmuntjg7SpB4N0ckkXlqb LVJef5RdBJ32sTsFue1OUwRae/EolE3XZAnQ2+XxWVPIh7/OOh1dRjbXd4ZESa4LZ2Eo QAPhsVXsj5a3dPbPo24528AN/wyavMn/guI8mAxz7Py3+9YM94KZY16BNQReg2cCIGEr HJ6HA6J7Y7BYQL5JoL86dK0G6lvBjBh1GjbojighOM90a6VIngUgRGdR7NpCV7dDFNFs HwhQ== 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=xkz8e5zoLl+P/xUlIkmPyH45rVLINuttESNxvxpX8Aw=; b=WWHX6JsTaD+cilH55mcwb02eH2JpLOUMHXWGWpP3ozbCaOQss6Sxz6xAyguKnsmgmK wfu35Yt9majRtVKUS1obExfVHu4FfIPV26Pl1APrSu/nYq9dSK+f0LqRJx+DrhJvilJ8 ocgzt1rgI9hk54C4gXjBqhyJcLb+9DBq77BLPmcQeTM1Wxhsr8e7f2TplcHT76TZ/R5v dJ+VQx4QHowpZSl1gN2er8EJ8oq0tohRH8Rd4dI4GqFs3mX0H3w3c8BjXpj/CS4nO4Lu QXbTQsBaRx8Jq2G0Pu0o8RxvVMgX1I5vJbJB0/A7mEhsfwWDJ6mrRq0eaQHONlL2/EjI huyw== X-Gm-Message-State: AOAM530/8Rndtquhz5kmG1D4K5rCnTfafgiDhEqJq9a3wGoAbj5CcXVa JSbR9DfBtkVmcgvmtNWM2hluZa/Iqj2GMqu0Uj5tLQ== X-Google-Smtp-Source: ABdhPJypFChcBkzFoquthKjD/24AdEw1F2MgJ9qToLmo3bIsOhEjDYJRxwCKXDd+h8fBIXpz3mR3FPRLVJtQ0pLXrB8= X-Received: by 2002:a25:ba08:: with SMTP id t8mr47509822ybg.111.1626898786723; Wed, 21 Jul 2021 13:19:46 -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> <0ee6775b-589c-3243-1c01-aafad5eecb73@redhat.com> In-Reply-To: <0ee6775b-589c-3243-1c01-aafad5eecb73@redhat.com> From: Suren Baghdasaryan Date: Wed, 21 Jul 2021 13:19:35 -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" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B17A5E0085CA X-Stat-Signature: pek71i71j4aazfkxgi838ad4grmscsot Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=mkhSJH5Y; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of surenb@google.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=surenb@google.com X-HE-Tag: 1626898787-421152 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 9:13 AM David Hildenbrand wrote: > > On 21.07.21 17:33, Suren Baghdasaryan wrote: > > 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? > > IMHO that could be an easy, possible alternative. Andrew, others? Should I follow this path instead? > > -- > Thanks, > > David / dhildenb > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >