Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1251051imc; Mon, 11 Mar 2019 09:33:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxZD0BZxOREAJdYf4yK48P0EUsqtopNW6tVsMSB5bTtluKnL0xuQOYEuHaWRm0sGfq+ynI X-Received: by 2002:aa7:8849:: with SMTP id k9mr33789896pfo.149.1552322017826; Mon, 11 Mar 2019 09:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552322017; cv=none; d=google.com; s=arc-20160816; b=jDYFy7V5lshnLN1xmHgho8wFIDMxtpEAtSavQicJAMTjr2YO5FPcvYvppUE26sLnbe 00oe407Xaq+4lcNt0FWwpcbVanZdcS5UpbCijZDeQAPl6Cs5kgKJe51aNcn/TrJPARaa jpkPLQxCU7AQNz1zkHqWytxzFHVD6N2SLXdnqGiKUwIvSDC4bke+8NNYvt9aIgv2TZBy +dwrcYXXiiDjhr1Nj4XFGFI5NBwACjNPGeE43WLG1tomdkSl4P2V9stS1dnesjt/YtR/ uU2ZE0Ut6ECAUg0ZEdHlUQl4IBWhmehu/l8LSdLXce81iLOH7kwcPD743fC9YRilrxsX aHDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pyQXcLatuiGi/bo6uxJQUtm3dUmwK7WB5Ls/qmNHhso=; b=nfhWy/26JyPJVgF5fTgVPcIDfINyDGwfTAJAm/9OUq1rSTZV2EmJZywAkrqbxAfLW0 jjJY4Xmqd9oKVSuORoY3OGj5erIkVvK9ImvY+UJ84cwH901e47Q9tJzWmFb7Zan9Xiqm M1rHbeIz7YVFz17ofmx7A2yy6Nxm2O+tIhdHJSoaYmV5iRI8VOmCxbw9Rmf+1RFZWeI4 8ZozqRtp9Thag24RiGvTfrH5OYZwPutPxj18P/p1pTGNs8Jgi1XvKpcVoVmVnuW/FOYU fs0o+d/uQqp2ol1TzGGix5cK7lpbXiVpqdJD66+oPW6zInkUlIsIr6q2YQQq2Wl4e7A+ mfAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=UiFtWTE1; 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 x8si5581662plv.137.2019.03.11.09.33.21; Mon, 11 Mar 2019 09:33:37 -0700 (PDT) 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=@joelfernandes.org header.s=google header.b=UiFtWTE1; 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 S1727716AbfCKQch (ORCPT + 99 others); Mon, 11 Mar 2019 12:32:37 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:46082 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726675AbfCKQcg (ORCPT ); Mon, 11 Mar 2019 12:32:36 -0400 Received: by mail-qk1-f196.google.com with SMTP id i5so3065283qkd.13 for ; Mon, 11 Mar 2019 09:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pyQXcLatuiGi/bo6uxJQUtm3dUmwK7WB5Ls/qmNHhso=; b=UiFtWTE1bEHCF2u3/E+AHCJsZr1xHyCgmuO83rSAJ75cHRKVt7ZV7WFfEifuAI5DAg JEHST3DheMpzW9st3pHb2jWx/2NzQeFxTxZ3x6eUFokWc1vhDU4RTGQQohR4PNKiuJMx mnPqswekcDWQ/SHL6b7Nm97cSTd/UZOu6mPNY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pyQXcLatuiGi/bo6uxJQUtm3dUmwK7WB5Ls/qmNHhso=; b=sQ9UT7yp7RqRzauSoJwCk9cBQHEMjV7pTTZgi7ein4DwQuu0GuOueEXauJGczZLFtI 9dOsNkxv9xQmb7Rvnzm/YpY/OVE/Cqq4uaQWAspMG0L9t8kLl0qJoDNBD5lNUsKQNK+D QL9s3zw83WIk1aJjPSU/oF5AYpr0qnGxpxKfA3y7U6B+b326fV485reTKukBmAH+lZ3y 6L1t7ej0lCiovuWK9mrgt92m7KQdCNDIByRyzdCjech/19/woJvbDi2d6+f0NG7faK0Z QaypwsbDVThyvfHJm55PovlXCQ2uK362g4NS6pWRLnBxLcu2iqRCnuXZrOdhFXDFlthz 60tg== X-Gm-Message-State: APjAAAU55R/na3ERiy/jsd/JfNjedJlXnLs8WSHF15Psgc2Wf1GQvbV8 BUUhMlMDOZ6Io3DchF/qiUJaxw== X-Received: by 2002:ae9:e901:: with SMTP id x1mr25640741qkf.124.1552321955265; Mon, 11 Mar 2019 09:32:35 -0700 (PDT) Received: from localhost ([2620:0:1004:1100:cca9:fccc:8667:9bdc]) by smtp.gmail.com with ESMTPSA id e4sm4037396qta.84.2019.03.11.09.32.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2019 09:32:34 -0700 (PDT) Date: Mon, 11 Mar 2019 12:32:33 -0400 From: Joel Fernandes To: Sultan Alsawaf Cc: Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Christian Brauner , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, Suren Baghdasaryan , Tim Murray , mhocko@kernel.org, vbabka@suse.cz, hannes@cmpxchg.org Subject: Re: [RFC] simple_lmk: Introduce Simple Low Memory Killer for Android Message-ID: <20190311163233.GA34252@google.com> References: <20190310203403.27915-1-sultan@kerneltoast.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190310203403.27915-1-sultan@kerneltoast.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 10, 2019 at 01:34:03PM -0700, Sultan Alsawaf wrote: [...] > > /* Perform scheduler related setup. Assign this task to a CPU. */ > retval = sched_fork(clone_flags, p); > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 3eb01dedf..fd0d697c6 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -67,6 +67,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -967,6 +968,11 @@ static inline void __free_one_page(struct page *page, > } > } > > +#ifdef CONFIG_ANDROID_SIMPLE_LMK > + if (simple_lmk_page_in(page, order, migratetype)) > + return; > +#endif > + > list_add(&page->lru, &zone->free_area[order].free_list[migratetype]); > out: > zone->free_area[order].nr_free++; > @@ -4427,6 +4433,13 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > if (costly_order && !(gfp_mask & __GFP_RETRY_MAYFAIL)) > goto nopage; > > +#ifdef CONFIG_ANDROID_SIMPLE_LMK > + page = simple_lmk_oom_alloc(order, ac->migratetype); > + if (page) > + prep_new_page(page, order, gfp_mask, alloc_flags); > + goto got_pg; > +#endif > + Hacking generic MM code with Android-specific callback is probably a major issue with your patch. Also I CC'd -mm maintainers and lists since your patch touches page_alloc.c. Always run get_maintainer.pl before sending a patch. I added them this time. Have you looked at the recent PSI work that Suren and Johannes have been doing [1]? As I understand, userspace lmkd may be migrated to use that at some point. Suren can provide more details. I am sure AOSP contributions to make LMKd better by using the PSI backend would be appreciated. Please consider collaborating on that and help out, thanks. Check the cover-letter of that patch [1] where LMKd is mentioned. thanks, - Joel [1] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1951257.html