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.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 5B30FC18E5A for ; Tue, 10 Mar 2020 22:20:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F1B8222C3 for ; Tue, 10 Mar 2020 22:20:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583878815; bh=ouP1NFbchhX5ebhDoeQYHhEGSpE9J2S6A04ue8Kskz8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=T2mRArTILckKOMNfC2dqDNiu9b4SL5UkD7Xy6stPu8CkOT5P2DEZ4FGs2CqKWNN+A eVcxpTLYe34DRl9t1EdyGpKQXrgg0jUC9r/BMUybbzt58BQehb32wrBbfsocVFQSPE rwVlTfTkSVj61+XTmQic9tq2WjaUB1tuVW08iy0Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727728AbgCJWUO (ORCPT ); Tue, 10 Mar 2020 18:20:14 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:45394 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726283AbgCJWUO (ORCPT ); Tue, 10 Mar 2020 18:20:14 -0400 Received: by mail-pl1-f193.google.com with SMTP id b22so76843pls.12; 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=Qdp//UsjJKj4ypX2jdnBwK4K792cytA+D41F+Z7GXhpr7yzx2K3Cd/xje7rS2kEKcn Byp4RP1Jm/NeYHbQYITo6ZxLRvdYoVSJp7qu/qTO9Djoi5BwjpJewdUWBP4C+A2wXc6h ep23QgmuZv2yI6lJQvP7gQ0YdnCkLibpvlTmqO0HOv0Z0qKP2LiPm+xe01DdBPcHIBuA 6oCH6ZhzCyYvJjk0DCqYOF2vbZQbjXHarsXz6YBz5K8CimO8mbjvW/DkLQNfiEride+K 1VCJpfkFBXiSfNe4gfJNstMx/sI8IJlXVmC3jsRtlyhUaoRt0bw1Udr5elEwrENg6Gxs WdKg== X-Gm-Message-State: ANhLgQ2FYdD0zi/1vLoEK7jWyuKDHJENINLIxq1XzbRJ53W3TIZ6yfGP kG9wQ88qPh/duv4yAnSJ/QQ= 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) Sender: linux-api-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org 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!