Received: by 10.223.164.202 with SMTP id h10csp6307400wrb; Wed, 22 Nov 2017 02:30:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMY8sHAk5aPE/ZDwbyv6rJjZMReX+SR6j3ELDv24Q8lYI1qNhpKyIM6+sph8rpvd0QmjaR7U X-Received: by 10.101.92.66 with SMTP id v2mr19970839pgr.151.1511346630779; Wed, 22 Nov 2017 02:30:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511346630; cv=none; d=google.com; s=arc-20160816; b=JepMVtGs1HIXWyGF/YQz14sAKKyy7IMlL0U3zKU0/6FQEu8cdQuxPJM4TnfLtkTW69 JT7pvdWOmEkuq0dJr5atvxw/nQzUrZhdPtixD9c3s2LUPBnkpw7g12vGCJPIiut/Ii+E Y0nEKJsVBRE/aarelIXKrf0mhEQF949AJUmXv8k/eNNP5aOx64ppM7VeVRzICLDO+eM/ z9ZRBhofg2+rRob9qw6PDnLjIDgdyctdBwB+Y/Bvkh72jk3R4qHS0EZ/9mm9GqjgHJDU Osf7F1k9WQy455b7lw8k/3FSTQHLjbf1qqr5NT6mKWeGyCv8gWQffiptOcwx070lnr7y 3IJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=jpZDtzRrMegUK4lM9o7/Kd5eUdh+n7oj5wzz7iUMndQ=; b=miGaYNYtBjiXU44ijbDPgQQ7GYOpLk9TFFu/MhoBY43s+LBb0eheM7+QYw/cRvQJAQ GvHLyQvgDJWIQhgOBCMFZRNVhGb69olrBV6n55Lz/P63+W6/pRJDmCfXUmupaGHWWadT vOuIFQcSH4wUKUa+0n6oOlMPccjDxB7uzjx1bu2a5IFZxBo4NZdAyCEbAv85NqyuL82v ozkADVOgTfobB/LXW56m/RbrmueVyMUQX2TsDaLBQ5BvfpF7WdUKsMRXz0dwILqoE9Ra Bxn8b0r4bgkrkiuyvPOVRDb0TNn8Zy4LQ/ZnkNXANlaYv6H1SvoA9mY/ywRj3wwsED54 2f8Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si14668175pfj.218.2017.11.22.02.30.19; Wed, 22 Nov 2017 02:30:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753199AbdKVK3p (ORCPT + 76 others); Wed, 22 Nov 2017 05:29:45 -0500 Received: from seldsegrel01.sonyericsson.com ([37.139.156.29]:15892 "EHLO SELDSEGREL01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746AbdKVK3m (ORCPT ); Wed, 22 Nov 2017 05:29:42 -0500 Subject: Re: [RFC v2] prctl: prctl(PR_SET_IDLE, PR_IDLE_MODE_KILLME), for stateless idle loops To: Shawn Landden CC: , , , References: <20171101053244.5218-1-slandden@gmail.com> <20171103063544.13383-1-slandden@gmail.com> From: peter enderborg Message-ID: Date: Wed, 22 Nov 2017 11:29:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171103063544.13383-1-slandden@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/03/2017 07:35 AM, Shawn Landden wrote: > It is common for services to be stateless around their main event loop. > If a process sets PR_SET_IDLE to PR_IDLE_MODE_KILLME then it > signals to the kernel that epoll_wait() and friends may not complete, > and the kernel may send SIGKILL if resources get tight. > > See my systemd patch: https://github.com/shawnl/systemd/tree/prctl > > Android uses this memory model for all programs, and having it in the > kernel will enable integration with the page cache (not in this > series). > > 16 bytes per process is kinda spendy, but I want to keep > lru behavior, which mem_score_adj does not allow. When a supervisor, > like Android's user input is keeping track this can be done in user-space. > It could be pulled out of task_struct if an cross-indexing additional > red-black tree is added to support pid-based lookup. What android version is using systemd? In android there is a OnTrimMemory that is sent from activitymanager that you can listen on and make a nice exit. From 1584658341615093097@xxx Tue Nov 21 07:06:00 +0000 2017 X-GM-THRID: 1583025769558696897 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread