Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1046707ybv; Wed, 19 Feb 2020 14:52:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzViGZaTa18xBbM7zSnfWYpx2pDySs/rTYiv6LZboNoyibnlWbzJjkRhAhPsltqn+zBvOd5 X-Received: by 2002:a9d:4d17:: with SMTP id n23mr21581604otf.85.1582152766175; Wed, 19 Feb 2020 14:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582152766; cv=none; d=google.com; s=arc-20160816; b=MgZVv9++QbFNpeawXA8Tp8yjxEQoYN5y7YBMfUnv76+ld8Cv942AvtFqw5PHoi3Hmt fEc8WXWMW3I+fdvjed2q8lIimtwV7aHGU8RcjZhkDvW5+tQTDukArOylC1FHj7yKJ5Ah jWeRkzJzjTNKXYVchI8cfY66zAWK2zE59FohHdVwIq6x51mRlKf01+aCZ9l6CEBpswN7 ujZa2CwHGLSf7LyFre0GDx1MUeLSx9I0Txo46O5ER1WAhYlRe9cXnCx77yG1IrZpa0gB 4j4nyYvJWY0o3J8r0Wdmo6JJT/W9Lnv4A/cNikNGD6JycTbIxqDUaVFuszJHpgnNY7nx YNRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4FX5hZLCPWe9TXE9QW2GtR6K9rNwkX1yJcBPCRG5Bqk=; b=lc2CuBMBjVeR7V7qw+CqV2jtCaU6ZBCHSJMW9baCadMMl8qpdIg/QFjf7UhhCW+eze lY6MsjjTpLACERreLXdh/+r2hokma7RGw/y/Dryn2WgvBxgzXDbG68HeomHxchIndY06 XVOj5miQoUraCw85ga0zyfJE/WDOo/c7eN7JjRlp3C+XDOZG+05oNIo8sOr76Xxg2ctS SvCjVAjnFM8ilHlkr9KjJeAGWOlxtzx8OPOhwybw3DWFAoBjI6OwKC0uZP7XSFvp5f7W 8Ffwsmzg1PzT3VzmaAPZkyK2OxhcoMoYi1vfbllM9ahaIeEy+q9tj3/IXhH8eqEuZx0g GOHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PcUbOCPz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13si671763otg.56.2020.02.19.14.52.34; Wed, 19 Feb 2020 14:52:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PcUbOCPz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727952AbgBSWwW (ORCPT + 99 others); Wed, 19 Feb 2020 17:52:22 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:33814 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbgBSWwW (ORCPT ); Wed, 19 Feb 2020 17:52:22 -0500 Received: by mail-ed1-f65.google.com with SMTP id r18so31283436edl.1 for ; Wed, 19 Feb 2020 14:52:20 -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=Km6x0RQ2iTGOTvJTDogQQ0auIpFygRUKrdWc1pd958qUeDCV3YwtnjHsTKUOCuLbEW qoABml1Dq68l7HQhhOUCuV5Q1KvKaQ65l3YWsrr/MFFMq4WpJ01M5T/d41cSRNMTEkex jrPjpOhBMEjFeuf8WtwLeuHKzs1EC0hV4y3yELXBbpz61LWO/XLRn9m8+yPhbZ3k2UhJ HWHyWpEiZaBUKwolRjVlC54XA2veFAJZemMvA0Prt5ogUbAYeo3HA2Ahxe/TCSOI6H/C BPHBz4o7rdMsbLIt8Z/jNOimBByv9rgDldK2w1v6y7CeukV5heAtKjrbFZiaeKJ4qi6r +GHA== X-Gm-Message-State: APjAAAXK1IudAB+VXnzmzNVDZXyjlRZNZE+e8RI5s8W01jCHNAdMQd0q omJGXIpHbE5+OF884GFD9EMgFyWyF8XqPG9JPgGzDQ== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.