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=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 7505AC3F2D2 for ; Thu, 5 Mar 2020 18:15:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A8B1208CD for ; Thu, 5 Mar 2020 18:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726162AbgCESPO (ORCPT ); Thu, 5 Mar 2020 13:15:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:54440 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbgCESPO (ORCPT ); Thu, 5 Mar 2020 13:15:14 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 15E96AE61; Thu, 5 Mar 2020 18:15:12 +0000 (UTC) Subject: Re: [PATCH v7 2/7] mm: introduce external memory hinting API To: Minchan Kim , Andrew Morton Cc: 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 References: <20200302193630.68771-1-minchan@kernel.org> <20200302193630.68771-3-minchan@kernel.org> From: Vlastimil Babka Message-ID: Date: Thu, 5 Mar 2020 19:15:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200302193630.68771-3-minchan@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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? > 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. ... > > Reviewed-by: Suren Baghdasaryan > Signed-off-by: Minchan Kim For the core parts, Reviewed-by: Vlastimil Babka