Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5772991pxv; Wed, 21 Jul 2021 13:46:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC0bB94FuNcMY0gsd12bkTHXblztX8L+H4v9P8t1VRZhbHSSe6yIxk1FeDs2uryhfMxjV2 X-Received: by 2002:aa7:c7d0:: with SMTP id o16mr50185479eds.75.1626900366041; Wed, 21 Jul 2021 13:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626900366; cv=none; d=google.com; s=arc-20160816; b=HBNUerM43FuOMvsQxbyW7cRXN1WiGTQPbFtPFIZtk3asXFmtELUclDrgEK+luX0CnY ybE3oIzG/4z1KLf7axxpUzQL+mgP4waUVreI0phfsCuiU3Pxa+MZrgoWi9gyq5n4faPD SOzf9GPrvVtGRYh7CnRGe3GQsNjvbLDl00yOjnkjXguZ1n34RxKhZLRvhIF25dCgaaoO QGhWzbfxjUuiuYmv81tdqIe/g9Vtg9YM6RjlMgYthey4u+SVX//4CzCOE7rnekeS+pdT p21uNv8w31XVE0m8FwyO/CylP5sEj0GZlIXSoJSCY4w7ebjiVtKmOXKehImKXZm9q11g 27xg== 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=xkz8e5zoLl+P/xUlIkmPyH45rVLINuttESNxvxpX8Aw=; b=oaKU1cd9xek8UxmyJWXoGu+hUGbIWFthCDoO3aC2c5cqxClkmlCLX8cjiRMBBws+o4 iAfB1AMRDbKfvOQhCe4Sy/agu/uvJdKeqhFWMOgbmdkMC3LFM6p11ub7uOlF4x5BKrGz yVAUtfmKv9t9YJyC2CetJluIiWN6ydaWXFOgPXSWFNS7X+G46wwS3q/ce1uAXALH38iN IWS0DdX1slhTbHrpEtvg95DGSB1MuceO3TjXtscC0LbOBzkedE47/pKBQDAgx4m3LOwm ZBCClQSCUktXIx1pK9oR2FVEUdfODI2vpzr85JSFcKKkKyLadvRHy18VIHLpPZeXIE1A HTLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mkhSJH5Y; 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 w10si34559009ejv.170.2021.07.21.13.45.43; Wed, 21 Jul 2021 13:46:06 -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=mkhSJH5Y; 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 S232508AbhGUTjN (ORCPT + 99 others); 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-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. >