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=-4.4 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FSL_HELO_FAKE,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 9462EC10DCE for ; Tue, 10 Mar 2020 22:20:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 37808208E4 for ; Tue, 10 Mar 2020 22:20:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IaoscK++" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37808208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DB1C76B0007; Tue, 10 Mar 2020 18:20:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D62FB6B0008; Tue, 10 Mar 2020 18:20:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C785B6B000A; Tue, 10 Mar 2020 18:20:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id B16806B0007 for ; Tue, 10 Mar 2020 18:20:13 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8C2E56137 for ; Tue, 10 Mar 2020 22:20:13 +0000 (UTC) X-FDA: 76580871906.16.store90_76570a872493a X-HE-Tag: store90_76570a872493a X-Filterd-Recvd-Size: 5416 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Mar 2020 22:20:13 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id ca13so1044224pjb.2 for ; Tue, 10 Mar 2020 15:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=LlDN/MK7CrxZu9xb4dnw85pho74h/DS1WZaWMDoSgwE=; b=IaoscK++5rxK6qZ2/FHYQ6nlJ6PK373ITCG+4MIjR6b15wJKYDBiHrpkrvwKiIrzcy jd5i7Tv56A+3iwRKTMn7g4jblcSKBPJAYEjpnozxVOHgKcOKJx/DlXW9wYRd2TX+XL/o 0BmjZ50iKsYDbGKlkUjW+mFNLLGW6XhVuroGLEdD8AcZeoPyL91qMUPU9wsCx2un4I6L GkT4zzZusm6zZNGr2OzV0wj5DP0+7TQA8mBCz5RyLzlCpax2XlXZ3uP7e6jad6JYwEtq njH+ZWG7B2AdxVjsWtt/FwvOS8HppVFclHmEo0912X0l1K1MDKr9Y6ho8dkyYIvxnX6d 90Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=LlDN/MK7CrxZu9xb4dnw85pho74h/DS1WZaWMDoSgwE=; b=rMxlzhJt5tkfiiMFypwmnRzkn7SP9QB2cr9FarhfF3eOED9zGyl6yL+nM9kNg3VHLY hq1mCxeHLG1ytBsDxo/Ct8bS1G4NMSLiOysf9rsHN5MAubNhpXzyO/t4LDqqg9Di+kPR zfC2qTOHzboxSo+mqheoybBXjwJ9vsbkgLNEF7SG1RjAd7vHRiJ4J2ZruLiwe7uRogdW EieKEgxHIlWfq4z7Dp5/OF6gEdvKEKH0cS6OhfA/S5BbIdN94UZjIUWg9FWiw+Z+BCqo fZWNw+jfJSxVvvZjZxFKLdqku5SHStrf4TyOu1CrXtp/X5mOUaaAKykohX3tfvDWhGtm k6Dw== X-Gm-Message-State: ANhLgQ3J0Z807cfK9vGgdoy5E6WFoN9O9YDBnLVHiyGttvJzcC53uYbo +Nz8QTiF8PAjy6HyoCE/VFY= X-Google-Smtp-Source: ADFU+vvk7+aqoNwobpRPQ+qRO3uj21tL5kgPUV7bKpFjuK4mVlX7rv3TJgflg2/ize2FmWV5IX7W0g== X-Received: by 2002:a17:902:528:: with SMTP id 37mr123615plf.322.1583878811879; Tue, 10 Mar 2020 15:20:11 -0700 (PDT) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id h24sm7528231pfn.49.2020.03.10.15.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 15:20:10 -0700 (PDT) Date: Tue, 10 Mar 2020 15:20:08 -0700 From: Minchan Kim To: Vlastimil Babka Cc: Andrew Morton , LKML , linux-mm , linux-api@vger.kernel.org, oleksandr@redhat.com, Suren Baghdasaryan , Tim Murray , Daniel Colascione , Sandeep Patil , Sonny Rao , Brian Geffon , Michal Hocko , Johannes Weiner , Shakeel Butt , John Dias , Joel Fernandes , Jann Horn , alexander.h.duyck@linux.intel.com, sj38.park@gmail.com Subject: Re: [PATCH v7 2/7] mm: introduce external memory hinting API Message-ID: <20200310222008.GB72963@google.com> References: <20200302193630.68771-1-minchan@kernel.org> <20200302193630.68771-3-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) 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 Thu, Mar 05, 2020 at 07:15:10PM +0100, Vlastimil Babka wrote: > On 3/2/20 8:36 PM, Minchan Kim wrote: > > There is usecase that System Management Software(SMS) want to give > > a memory hint like MADV_[COLD|PAGEEOUT] to other processes and > > in the case of Android, it is the ActivityManagerService. > > > > It's similar in spirit to madvise(MADV_WONTNEED), but the information > > You mean MADV_DONTNEED? Mean to DONT_NEED's future version. > > > required to make the reclaim decision is not known to the app. > > This seems to be mixing up the differences between MADV_DONTNEED and > COLD/PAGEOUT and self-imposed vs external memory hints? Sorry, I don't understand what you want here. > > > Instead, > > it is known to the centralized userspace daemon(ActivityManagerService), > > and that daemon must be able to initiate reclaim on its own without > > any app involvement. > > > > To solve the issue, this patch introduces a new syscall process_madvise(2). > > It uses pidfd of an external process to give the hint. > > > > int process_madvise(int pidfd, void *addr, size_t length, int advise, > > unsigned long flag); > > It's more common to call the argument 'flags' not 'flag'? The code seems to call > it flags. Also in line with madvise(2), the 'advise' argument should rather be > 'advice'. This is more important for the manpage, but let's be consistent. Yub, I will send the patch along with your comment in previous patch. > > ... > > > > > Reviewed-by: Suren Baghdasaryan > > Signed-off-by: Minchan Kim > > For the core parts, > Reviewed-by: Vlastimil Babka Thanks for the review!