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=-3.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 0CE0EC282DD for ; Fri, 10 Jan 2020 21:34:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BBD0320848 for ; Fri, 10 Jan 2020 21:34:40 +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="Ysp3fcGZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBD0320848 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 58FCF8E0005; Fri, 10 Jan 2020 16:34:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 51A298E0001; Fri, 10 Jan 2020 16:34:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E1898E0005; Fri, 10 Jan 2020 16:34:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0185.hostedemail.com [216.40.44.185]) by kanga.kvack.org (Postfix) with ESMTP id 247348E0001 for ; Fri, 10 Jan 2020 16:34:40 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id C506E8248D7C for ; Fri, 10 Jan 2020 21:34:39 +0000 (UTC) X-FDA: 76363029078.08.seed54_b8ba1f7f3d4a X-HE-Tag: seed54_b8ba1f7f3d4a X-Filterd-Recvd-Size: 5784 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Fri, 10 Jan 2020 21:34:39 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id s64so1572271pgb.9 for ; Fri, 10 Jan 2020 13:34:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kUxvkA/9wBEhfF4c0Ct5r0wRWCEBzV0f25SyUAAjvzQ=; b=Ysp3fcGZ5hTzZMkrpsarvwMsGJeWWUxqKFw0tO8sE+eOKLDBShkkvEo5ksv7WIJjfu U4DXzuq2MGcxaDZ1TWoEfIJx6xtxles0BkiWMEraZVR0iti5nYCd15SmFBPt5SBwKb3h EVNA+zdD8XN3KaHinsDhLVDT9DCPrcrXEbFc9uirjDf3851eDnp8874XUwC5m/CuOJ4d L/RV4hNQB5k/+DI7EZ69gRmZql6dFK43gDmTPbfbJWmQetNrGkIJJvbMHe55EdnYlCmT xSySiRihDqmJfiDkCbW1LxLed06ZW21aPe1FUANQyy3pcQoCHrNYPNd7wDqDRD6egZ0a ZShA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=kUxvkA/9wBEhfF4c0Ct5r0wRWCEBzV0f25SyUAAjvzQ=; b=tXXp3UpOg12V5tISn7pHoV2GxZXf/YplHdtIBv2RTCcyD4BhEtbBzVZMxchnPT1P5P qxcsQeEHW16Rh+ylFLjyRjqOf1gv/8Xp5l4SZZGCUHn7lR7ezBeMJ9HAnpzkRmwlb6x2 Iu0LQB9yP1HerECBUQgrUInwGqoHe0pPqibzkXehAdNkJ0H0sFyx3KwbBeyaL43eRL4W oKcrKOt9nzJbzRuqys6IpDbdl2nynOtmlC6Uw1YHdyuUY7o5NG/5kuKNzvvp5Zc9EOaR xxe68yPB3v2+LMw+LzTV/Y83R1yoiXu2scnRbiujNPSHEZs/BC8Tj16Rgftqr2LVl84o 1+Og== X-Gm-Message-State: APjAAAWuMZmrYlKEm60oxw8C7EfVOe+iTjrm4swn2K70NgVxrVqZUw7X gWHJSPGJIubb+NuSWrYs9Ag= X-Google-Smtp-Source: APXvYqxARsDrk+ixhGWJoPkKby6xFB+IlE0oFwuWc/PMGRgL/6mrQg84c+egjiIFNPaOAzor8ns0Pg== X-Received: by 2002:aa7:928b:: with SMTP id j11mr6465632pfa.176.1578692078184; Fri, 10 Jan 2020 13:34:38 -0800 (PST) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id t137sm3692307pgb.40.2020.01.10.13.34.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 13:34:37 -0800 (PST) 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 , Minchan Kim Subject: [PATCH 0/4] introduce memory hinting API for external process Date: Fri, 10 Jan 2020 13:34:29 -0800 Message-Id: <20200110213433.94739-1-minchan@kernel.org> X-Mailer: git-send-email 2.25.0.rc1.283.g88dfdc4193-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: 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., ActivityMana= gerService), and that daemon must be able to initiate reclaim on its own without any a= pp 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 mome= nt. 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. Minchan Kim (2): mm: factor out madvise's core functionality mm: introduce external memory hinting API Oleksandr Natalenko (2): mm/madvise: employ mmget_still_valid for write lock mm/madvise: allow KSM hints for remote API 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/syscalls.h | 2 + include/uapi/asm-generic/unistd.h | 5 +- kernel/sys_ni.c | 1 + mm/madvise.c | 263 ++++++++++++++------ 21 files changed, 205 insertions(+), 85 deletions(-) --=20 2.25.0.rc1.283.g88dfdc4193-goog