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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 08668C5ACC5 for ; Wed, 19 Feb 2020 22:52:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BCB9A206F4 for ; Wed, 19 Feb 2020 22:52:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PcUbOCPz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCB9A206F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 57F856B000A; Wed, 19 Feb 2020 17:52:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 52F926B000C; Wed, 19 Feb 2020 17:52:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41F5B6B000D; Wed, 19 Feb 2020 17:52:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 2B6F16B000A for ; Wed, 19 Feb 2020 17:52:22 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E0B62181AEF0B for ; Wed, 19 Feb 2020 22:52:21 +0000 (UTC) X-FDA: 76508376882.21.sheet68_6be693562b00a X-HE-Tag: sheet68_6be693562b00a X-Filterd-Recvd-Size: 6343 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Feb 2020 22:52:21 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id p3so31266629edx.7 for ; Wed, 19 Feb 2020 14:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4FX5hZLCPWe9TXE9QW2GtR6K9rNwkX1yJcBPCRG5Bqk=; b=PcUbOCPznDsTd1uUy3g6aidkM7d0tqqur5WbsmxlcTY+nlyZ1Af+UWhbMKlJkJytm4 8fsXPlCWs1AKEaFZ7Ux2tSFs5WpV+2HksQY6tsT0vnFOnt4rvX5gOEfjpvsuAum+td0f lZaXfYTKV/qwMIZRQeWPKhSXS6amhShfMgQSTbbJZvp3cZTuWAOY9qwblEdAjIlbzWMs DI2tmAEtZWaYnP8KX0S/EwZwv9QIqwK4dSzYI+QOzBAI/fJsmMmnctj5mssKRHkRVgqe lWS0XkC5IUhK/70DTcyP9ebbkiZ7p7bQ6GlZkUDhqaw4E0qc+nhtxBAlfd+EchWkH4ps EjiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4FX5hZLCPWe9TXE9QW2GtR6K9rNwkX1yJcBPCRG5Bqk=; b=k3tKzt0N48UOAlC9vcpRCCl/XXoiX8+SOB0tiAL+qPodsfDcGW+7sH3Ie0g7nZsW9y Ng4+7boad5YIjSAOuK2wqFciEfVY54gDWSiq6HhgtBHt3/b/+YZIgTNKDX2r1Jsso8vv 5rFb66OomyfLK0ZhPMB5QnxY2wdalV3ZcOx8CzbHZOfsWaj3r/tb4tSZBGMC3JKkaezQ qtvvnQoal1Q8jNr6c2pIVmEkuf2CbeUSsWz3P6NSPaPQQiI51sfFc+5NJknb//DaxDR0 sK6/JtxyGJPnVeQaQfQrTte14WrEUZSzNwSZnezfyNdfOtrxU8HiFFYIfxsgpBTOX2/K r6iA== X-Gm-Message-State: APjAAAWhiShna/nolun0EendK9EA1zMDBPOoAwfhj0so/EyNIHwDttCh OcyENZ3D0DU3PZiZ4o34Xov2XCVvI4XwWyihJTbiRQ== X-Google-Smtp-Source: APXvYqx0+8EApKqslGjXjpM5Azv3t3MhoqMEF0b2EBiqIdz/10EUJ8xYiTg6j4DRMnQSSSoQLlMY7NlD++332yBh21o= X-Received: by 2002:a17:906:4e01:: with SMTP id z1mr26915118eju.46.1582152739691; Wed, 19 Feb 2020 14:52:19 -0800 (PST) MIME-Version: 1.0 References: <20200219014433.88424-1-minchan@kernel.org> <20200219120123.07dda51c29006a892059ccde@linux-foundation.org> <20200219223241.GA148976@google.com> In-Reply-To: <20200219223241.GA148976@google.com> From: Brian Geffon Date: Wed, 19 Feb 2020 14:51:53 -0800 Message-ID: Subject: Re: [PATCH v6 0/7] introduce memory hinting API for external process To: Minchan Kim Cc: Andrew Morton , LKML , linux-mm , Linux API , oleksandr@redhat.com, Suren Baghdasaryan , Tim Murray , Daniel Colascione , Sandeep Patil , Sonny Rao , Michal Hocko , Johannes Weiner , Shakeel Butt , John Dias , Joel Fernandes , sj38.park@gmail.com, alexander.h.duyck@linux.intel.com, Jann Horn Content-Type: text/plain; charset="UTF-8" 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: To expand on how ChromeOS benefits from this, we've advanced far beyond the experimentation phase we've deployed an older version of this idea that was procfs based on several ChromeOS kernels. These are now rolled out to ChromeOS stable channel where we've been testing and the results have been amazing. To elaborate on the setup, Chrome is a multi process architecture where each tab is a separate process and sometimes a single tab can even represent multiple processes. The primary Chrome process has a lot of visibility into the amount of time a user has been spending interacting with a tab (process) and using this knowledge these hints provided to the kernel allow it to make much better swap decisions and amortize the cost of swap over different memory pressure levels meaning that we were better able to reclaim memory which allow us to avoid having to discard tabs or even worse oom. I'd be happy to expand even more if anyone is interested. Brian On Wed, Feb 19, 2020 at 2:32 PM Minchan Kim wrote: > > Hi Andrew, > > On Wed, Feb 19, 2020 at 12:01:23PM -0800, Andrew Morton wrote: > > On Tue, 18 Feb 2020 17:44:26 -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. > > > > > > > This patchset doesn't seem to be getting a lot of interest from other > > potential users? It seems very specialized. Are there or will there > > ever be any users of this apart from one Android daemon? > > > Quote from http://lkml.kernel.org/r/20190531064313.193437-1-minchan@kernel.org > > " > Brian Geffon in ChromeOS team had an experiment with process_madvise(2) > Quote form him: > "What I found is that by using process_madvise after a tab has been back > grounded for more than 45 seconds reduced the average tab switch times by > 25%! This is a huge result and very obvious validation that process_madvise > hints works well for the ChromeOS use case." > " > > > > > Also, it doesn't terribly hard for ActivityManagerService to tell > > another process "now run madvise with these arguments". Please explain > > why this is not practical in ActivityManagerService and also within > > other potential users of this syscall. > > I think that's the almost a same question why ptrace doesn't work so > I summarizes the part in [2/7]: > > * makes target task runnable creates memory layout change window so > hiniting a wrong vma > > * target task(e.g., background task) could live in little core with > cpuset/group limited environment so we couldn't react quick enough, > which causes more killing. > > > Thanks.