Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp336643pxt; Fri, 6 Aug 2021 03:18:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTdX7Mm7LNfTVRzGJdOrt1eL+xTfC9qt52R3hc8NjqayMe73jGE3LrTsA2vw5oUtk8JGYR X-Received: by 2002:a6b:5d18:: with SMTP id r24mr204810iob.156.1628245133583; Fri, 06 Aug 2021 03:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628245133; cv=none; d=google.com; s=arc-20160816; b=ZGxF3So1aCtUpJ9SQ8SCe1YRM9chkf7gCknrBQOhrh+BalWaK+4nbu6+tBHtrbCpgq 69raAsUxvC9Bmug3ihfKKVwI8OenO6E7AIdSPH4ofUZnahAbIVg1Q8mVaZd5a5EnfVoI n7pAMCQWXijH+rOxVIVv4CV0ISHXvnxvZ6+4PofQfCPhRULDoFDUC0RA2WqsHJtaoyUK YyxtW2/p+YJPW0mv3VBFhFmPmuP0UyqQdczshEfp0EMjfaIU0dHLSyOJRVY5W4tYLNr1 ckcFIz6bJvwxr7un/TyOApVctNLfm2KScKyrVr+600kOKFkwo0MX43Y9VNopohiYhEte VJVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QFGRy0TVO6Sv+kOUDL6gKJLzvhAhsmyj9YyaOQWydKs=; b=Y4NYiF8Q/DsD+GTp16lt4i0sONGVyqEugZdVUY799K9VsFG+mHdlkV4Ybf12+CLwTx oraWgxEWE99NoasY+c1HOzvqr/jlTiEQ32u+TuVnqkyrZDhpUfYDQkEIsfqqS6+w61UR suyuE9UZAkuWkLBBg7Yfr//zayBuhrZVZGKzaJe8EcH+ZvrzHK1I8HVByWUituNCwZwc Qsrwa9o1M77hTUGONgbtLL9Rks3xPSSpNoxkqJ96iWJRgH4s+SorBMZT+bd1bXUPc2uq gRQ3gakloQc+tfBqc8bFebk+MNwKLXOYSjtzfGMw29OzJ0UTSBM2E8b3oNWsXhbeG1ZT T1qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="syvPzm/l"; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si8179579jao.103.2021.08.06.03.18.40; Fri, 06 Aug 2021 03:18: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=@suse.com header.s=susede1 header.b="syvPzm/l"; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244947AbhHFKPV (ORCPT + 99 others); Fri, 6 Aug 2021 06:15:21 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:44146 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244773AbhHFKPT (ORCPT ); Fri, 6 Aug 2021 06:15:19 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E01A222369; Fri, 6 Aug 2021 10:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1628244902; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QFGRy0TVO6Sv+kOUDL6gKJLzvhAhsmyj9YyaOQWydKs=; b=syvPzm/lthsXkM5NM4glpb2MPQNmaSopqfCTTaMkrKi5PbeuC8rIgUdn27XRNSTHYiK0+O 85ZkxXSjmmCRROz5BZ4PpgyIGbd+6jgPfCWwvkCDFmSETl56dvEi6BbGb81OvhaYpQutMv q4fxt2MEFHLW3OZXZreuY1B2dKlEaX4= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 47BE0A3B85; Fri, 6 Aug 2021 10:15:02 +0000 (UTC) Date: Fri, 6 Aug 2021 12:15:01 +0200 From: Michal Hocko To: Shakeel Butt Cc: Suren Baghdasaryan , Andrew Morton , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Minchan Kim , Christian Brauner , Christoph Hellwig , Oleg Nesterov , David Hildenbrand , Jann Horn , Andy Lutomirski , Christian Brauner , Florian Weimer , Jan Engelhardt , Tim Murray , Linux API , Linux MM , LKML , kernel-team Subject: Re: [PATCH v7 1/2] mm: introduce process_mrelease system call Message-ID: References: <20210805170859.2389276-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 06-08-21 02:23:17, Shakeel Butt wrote: > On Thu, Aug 5, 2021 at 11:40 PM Michal Hocko wrote: > > > [...] > > I think you really want something like this: > > > > if (flags) > > return -EINVAL; > > > > pid = pidfd_get_pid(fd, &f_flags); > > if (IS_ERR(pid)) > > return PTR_ERR(pid); > > task = get_pid_task(pid, PIDTYPE_PID); > > if (!task) { > > ret = -ESRCH; > > goto put_pid; > > } > > > > /* > > * Make sure to chose a thread which still has a reference to mm > > * during the group exit > > */ > > p = find_lock_task_mm(task); > > if (!p) { > > ret = -ESRCH; > > goto put_task; > > } > > > > mm = task->mm; > > mm = p->mm; right. Thanks! -- Michal Hocko SUSE Labs