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=-0.7 required=3.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 3F1F3CA9EC0 for ; Tue, 29 Oct 2019 03:04:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CFADA20830 for ; Tue, 29 Oct 2019 03:04:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFADA20830 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 758476B0005; Mon, 28 Oct 2019 23:04:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 709B66B0006; Mon, 28 Oct 2019 23:04:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61EAC6B0007; Mon, 28 Oct 2019 23:04:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 35AEA6B0005 for ; Mon, 28 Oct 2019 23:04:35 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id D607121F0 for ; Tue, 29 Oct 2019 03:04:34 +0000 (UTC) X-FDA: 76095329268.13.hope45_27cb1f081f70f X-HE-Tag: hope45_27cb1f081f70f X-Filterd-Recvd-Size: 2765 Received: from r3-25.sinamail.sina.com.cn (r3-25.sinamail.sina.com.cn [202.108.3.25]) by imf23.hostedemail.com (Postfix) with SMTP for ; Tue, 29 Oct 2019 03:04:33 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([222.131.69.34]) by sina.com with ESMTP id 5DB7AC3C00019344; Tue, 29 Oct 2019 11:04:30 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 77485054921857 From: Hillf Danton To: Johannes Weiner Cc: Hillf Danton , linux-mm , Andrew Morton , linux-kernel , Matthew Wilcox , Michal Hocko , Shakeel Butt , Minchan Kim , Mel Gorman , Vladimir Davydov , "Kirill A. Shutemov" , Jan Kara Subject: Re: [RFC v2] mm: add page preemption Date: Tue, 29 Oct 2019 11:04:18 +0800 Message-Id: <20191029030418.18624-1-hdanton@sina.com> In-Reply-To: <20191026112808.14268-1-hdanton@sina.com> References: 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: Date: Mon, 28 Oct 2019 11:56:17 -0400 Johannes Weiner wrote: >=20 > On Sat, Oct 26, 2019 at 07:28:08PM +0800, Hillf Danton wrote: > >=20 > > The cpu preemption feature makes a task able to preempt other tasks > > of lower priorities for cpu. It has been around for a while. > >=20 > > This work introduces task prio into page reclaiming in order to add > > the page preemption feature that makes a task able to preempt other > > tasks of lower priorities for page. > >=20 > > No page will be reclaimed on behalf of tasks of lower priorities >=20 > ... at which point they'll declare OOM and kill the high-pri task? Fixed. Thanks. --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -164,6 +164,11 @@ static bool oom_unkillable_task(struct t return true; if (p->flags & PF_KTHREAD) return true; + +#ifdef CONFIG_PAGE_PREEMPTION + if (p->prio < current->prio) + return true; +#endif return false; } =20 -- > Please have a look at the cgroup2 memory.low control. This memory > prioritization problem has already been solved. Scooter never runs in subway. Fixed. --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -197,8 +198,18 @@ struct page { /* Usage count. *DO NOT USE DIRECTLY*. See page_ref.h */ atomic_t _refcount; =20 + /* 32/56 bytes above */ + #ifdef CONFIG_MEMCG struct mem_cgroup *mem_cgroup; +#else +#ifdef CONFIG_64BIT + union { + int prio; + void *__pad; + }; +#define CONFIG_PAGE_PREEMPTION PP +#endif #endif =20 /* --