From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752116AbcF1APA (ORCPT ); Mon, 27 Jun 2016 20:15:00 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34380 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018AbcF1AO7 (ORCPT ); Mon, 27 Jun 2016 20:14:59 -0400 Date: Mon, 27 Jun 2016 17:14:31 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Vladimir Davydov cc: Andrew Morton , Michal Hocko , Johannes Weiner , Tetsuo Handa , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm: oom: deduplicate victim selection code for memcg and global oom In-Reply-To: <1467045594-20990-1-git-send-email-vdavydov@virtuozzo.com> Message-ID: References: <1467045594-20990-1-git-send-email-vdavydov@virtuozzo.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Jun 2016, Vladimir Davydov wrote: > When selecting an oom victim, we use the same heuristic for both memory > cgroup and global oom. The only difference is the scope of tasks to > select the victim from. So we could just export an iterator over all > memcg tasks and keep all oom related logic in oom_kill.c, but instead we > duplicate pieces of it in memcontrol.c reusing some initially private > functions of oom_kill.c in order to not duplicate all of it. That looks > ugly and error prone, because any modification of select_bad_process > should also be propagated to mem_cgroup_out_of_memory. > > Let's rework this as follows: keep all oom heuristic related code > private to oom_kill.c and make oom_kill.c use exported memcg functions > when it's really necessary (like in case of iterating over memcg tasks). > I don't know how others feel, but this actually turns out harder to read for me with all the extra redirection with minimal savings (a few dozen lines of code).