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=-0.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FSL_HELO_FAKE,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 8F404C3B186 for ; Mon, 10 Feb 2020 21:29:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 40A8C2070A for ; Mon, 10 Feb 2020 21:29:12 +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="f3iXybZC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40A8C2070A 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 CC1316B0179; Mon, 10 Feb 2020 16:29:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C48436B017B; Mon, 10 Feb 2020 16:29:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0FCE6B017C; Mon, 10 Feb 2020 16:29:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 95D9E6B0179 for ; Mon, 10 Feb 2020 16:29:11 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 24E10181AEF07 for ; Mon, 10 Feb 2020 21:29:11 +0000 (UTC) X-FDA: 76475508102.04.wire76_15ebc19c90105 X-HE-Tag: wire76_15ebc19c90105 X-Filterd-Recvd-Size: 7062 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Feb 2020 21:29:10 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id 4so4322944pfz.9 for ; Mon, 10 Feb 2020 13:29:10 -0800 (PST) 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=QvVz9922RfF2M1+1YzT1xJSqO9QWTEbfw1OgBUiAzxg=; b=f3iXybZCwiAqO2xW8Tlb/FVBLhA2rSaY3BL76+rAIN7wdcnN70ILBegXv6zg7wVlq8 KRqsWAiLrExj+v58hd8V8oW92Q+9ADGIUBDGAJVjb2q3j+pRHat33sfxB6rYExr3M/sR ze0T9hXxw9sOqBztAP2sv/DOEWuu61CDUdPFczSlD8TopoH20D6pEPTK7OX05IcOGpNg hPEP4E6u0xbBUNjKA1hTzuXWdknRKSiNTcc+JWze1DmRbkCpDdLnkbXTuWItGBsGMWRW dd2I7lA55DW8qQKlsZai/QfrMYhliQljcd2x2XGBHRfStEaG3iNONUBrwHSX4vWrA7W2 x5Ug== 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=QvVz9922RfF2M1+1YzT1xJSqO9QWTEbfw1OgBUiAzxg=; b=DO8kojnVmMqD9lk9QNZ6Vhtbf594FrBkwP/3HOQm0W9PWIC8t0XGmlltlHlTiCp3dI hpGXkKcqJeqAGeApvVupL2LkAKfuzxTUVi8dlNCX3xeb+cK3KIqjqp+R425Iou5r35JI jqfDodHQmRo411idN5YBC6qzhD1xGuD1qqbouJcq+gEbEJRWjHrfN4qanFLc57OmjVoD h2OgEkq/fEA5p5nPtkbYx2XZUpVtgWtEeVyBnbyw/ANE6DORwoSDpz1hMJazpho2bDpf WIu04qgGqVV5pAgIIcyfdGswDF3+9yRCFOYfczACfLnG9iXllg4ZQZ2TOQrEmI5hADns D/Tg== X-Gm-Message-State: APjAAAUAmUDEFf2EOSTXoQAgnOd44DsmSSG2dTiYbkM6Qu4gGVTY+bWb xBFNSw0KNC75elDAZ1eFEUM= X-Google-Smtp-Source: APXvYqxvk99N91MDZTtsbJVoIIwFDq9wyGpNlqr7sX1WQCjiL8xuRUBqCIaB3ZV7nYedOYds0c9s5w== X-Received: by 2002:a62:e91a:: with SMTP id j26mr3057541pfh.189.1581370149447; Mon, 10 Feb 2020 13:29:09 -0800 (PST) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id w8sm1437320pfj.20.2020.02.10.13.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 13:29:08 -0800 (PST) Date: Mon, 10 Feb 2020 13:29:06 -0800 From: Minchan Kim To: 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 Subject: Re: [PATCH v3 0/5] introduce memory hinting API for external process Message-ID: <20200210212906.GB48790@google.com> References: <20200128001641.5086-1-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200128001641.5086-1-minchan@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) 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: Hey Folks, Can I get review further since I resolved most of concerns(especially, description stuff) I got from previous iteration? On Mon, Jan 27, 2020 at 04:16:36PM -0800, Minchan Kim wrote: > Now, we have MADV_PAGEOUT and MADV_COLD as madvise hinting API. With that, > application could give hints to kernel what memory range are preferred to be > reclaimed. However, in some platform(e.g., Android), the information > required to make the hinting decision is not known to the app. > Instead, it is known to a centralized userspace daemon(e.g., ActivityManagerService), > and that daemon must be able to initiate reclaim on its own without any app > involvement. > > To solve the concern, this patch introduces new syscall - process_madvise(2). > Bascially, it's same with madvise(2) syscall but it has some differences. > > 1. It needs pidfd of target process to provide the hint > 2. It supports only MADV_{COLD|PAGEOUT|MERGEABLE|UNMEREABLE} at this moment. > Other hints in madvise will be opened when there are explicit requests from > community to prevent unexpected bugs we couldn't support. > 3. Only privileged processes can do something for other process's address > space. > > For more detail of the new API, please see "mm: introduce external memory hinting API" > description in this patchset. > > Minchan Kim (3): > mm: factor out madvise's core functionality > mm: introduce external memory hinting API > mm: support both pid and pidfd for process_madvise > > Oleksandr Natalenko (2): > mm/madvise: employ mmget_still_valid for write lock > mm/madvise: allow KSM hints for remote API > > * from v2 - https://lore.kernel.org/linux-mm/20200116235953.163318-1-minchan@kernel.org/ > * check signal callee and caller to bail out - Kirill Tkhai > * put more clarification for justification of new API > > * from v1 - https://lore.kernel.org/linux-mm/20200110213433.94739-1-minchan@kernel.org/ > * fix syscall number - SeongJae > * use get_pid_task - Kirill Tkhai > * extend API to support pid as well as pidfd - Kirill Tkhai > > arch/alpha/kernel/syscalls/syscall.tbl | 1 + > arch/arm/tools/syscall.tbl | 1 + > arch/arm64/include/asm/unistd.h | 2 +- > arch/arm64/include/asm/unistd32.h | 2 + > arch/ia64/kernel/syscalls/syscall.tbl | 1 + > arch/m68k/kernel/syscalls/syscall.tbl | 1 + > arch/microblaze/kernel/syscalls/syscall.tbl | 1 + > arch/mips/kernel/syscalls/syscall_n32.tbl | 1 + > arch/mips/kernel/syscalls/syscall_n64.tbl | 1 + > arch/parisc/kernel/syscalls/syscall.tbl | 1 + > arch/powerpc/kernel/syscalls/syscall.tbl | 1 + > arch/s390/kernel/syscalls/syscall.tbl | 1 + > arch/sh/kernel/syscalls/syscall.tbl | 1 + > arch/sparc/kernel/syscalls/syscall.tbl | 1 + > arch/x86/entry/syscalls/syscall_32.tbl | 1 + > arch/x86/entry/syscalls/syscall_64.tbl | 1 + > arch/xtensa/kernel/syscalls/syscall.tbl | 1 + > include/linux/pid.h | 1 + > include/linux/syscalls.h | 3 + > include/uapi/asm-generic/unistd.h | 5 +- > kernel/exit.c | 17 -- > kernel/pid.c | 17 ++ > kernel/sys_ni.c | 1 + > mm/madvise.c | 277 ++++++++++++++------ > 24 files changed, 238 insertions(+), 102 deletions(-) > > -- > 2.25.0.341.g760bfbb309-goog >