From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760237AbZGIK7Q (ORCPT ); Thu, 9 Jul 2009 06:59:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758723AbZGIK7C (ORCPT ); Thu, 9 Jul 2009 06:59:02 -0400 Received: from mail-yx0-f188.google.com ([209.85.210.188]:37426 "EHLO mail-yx0-f188.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758100AbZGIK7A (ORCPT ); Thu, 9 Jul 2009 06:59:00 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=jR04yU+5llGxvnx6kBx9hxdQaX4XuQWbm3IHs5j6m4ySrp2l82exLQlXAGWmalXys+ tcS9hov500a6BU8E5YANNu8xnHWg/qeciZpNiXZEY6tgXZlkohbb/FFWuReVHa1nFKki A7pc132VRkx7I+/Dyfq/Tt/QkENWR+IEhoeCI= MIME-Version: 1.0 In-Reply-To: <20090709140234.239F.A69D9226@jp.fujitsu.com> References: <20090707184714.0C73.A69D9226@jp.fujitsu.com> <28c262360907070620n3e22801egd4493c149a263ecd@mail.gmail.com> <20090709140234.239F.A69D9226@jp.fujitsu.com> Date: Thu, 9 Jul 2009 19:58:59 +0900 Message-ID: <28c262360907090358q7cdbd067y22b7312c489e7598@mail.gmail.com> Subject: Re: [RFC PATCH 2/2] Don't continue reclaim if the system have plenty free memory From: Minchan Kim To: KOSAKI Motohiro Cc: LKML , linux-mm , Andrew Morton , Rik van Riel , Wu Fengguang Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 9, 2009 at 2:08 PM, KOSAKI Motohiro wrote: >> Hi, Kosaki. >> >> On Tue, Jul 7, 2009 at 6:48 PM, KOSAKI >> Motohiro wrote: >> > Subject: [PATCH] Don't continue reclaim if the system have plenty free memory >> > >> > On concurrent reclaim situation, if one reclaimer makes OOM, maybe other >> > reclaimer can stop reclaim because OOM killer makes enough free memory. >> > >> > But current kernel doesn't have its logic. Then, we can face following accidental >> > 2nd OOM scenario. >> > >> > 1. System memory is used by only one big process. >> > 2. memory shortage occur and concurrent reclaim start. >> > 3. One reclaimer makes OOM and OOM killer kill above big process. >> > 4. Almost reclaimable page will be freed. >> > 5. Another reclaimer can't find any reclaimable page because those pages are >> > ? already freed. >> > 6. Then, system makes accidental and unnecessary 2nd OOM killer. >> > >> >> Did you see the this situation ? >> Why I ask is that we have already a routine for preventing parallel >> OOM killing in __alloc_pages_may_oom. >> >> Couldn't it protect your scenario ? > > Can you please see actual code of this patch? I mean follow as, static inline struct page * __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist, enum zone_type high_zoneidx, ... /* * Go through the zonelist yet one more time, keep very high watermark * here, this is only to catch a parallel oom killing, we must fail if * we're still under heavy pressure. */ page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, nodemask, order, zonelist, high_zoneidx, ALLOC_WMARK_HIGH|ALLOC_CPUSET, preferred_zone, migratetype); > Those two patches fix different problem. > > 1/2 fixes the issue of that concurrent direct reclaimer makes > too many isolated pages. > 2/2 fixes the issue of that reclaim and exit race makes accidental oom. > > >> If it can't, Could you explain the scenario in more detail ? > > __alloc_pages_may_oom() check don't effect the threads of already > entered reclaim. it's obvious. Threads which are entered into direct reclaim mode will call __alloc_pages_may_oom before out_of_memory. At that time, if one big process is killed a while ago, get_page_from_freelist in __alloc_pages_may_oom will be succeeded at last. So I think it doesn't occur OOM. But in that case, we suffered from unnecessary page scanning per each priority(12~0). So in this case, your patch is good to me. then you would be better to change log. :) -- Kind regards, Minchan Kim