Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp365740ybh; Wed, 11 Mar 2020 02:36:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvoQ1yg0prl1+/wR06PiDPhHOsUNyhWLSMbk3N6S55OxuCu1wUi0hQK+OKTGbGuqipqUC+P X-Received: by 2002:aca:5ad5:: with SMTP id o204mr1256512oib.2.1583919415534; Wed, 11 Mar 2020 02:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583919415; cv=none; d=google.com; s=arc-20160816; b=AQRwbRpkCXVCKdWiIYkjUM1/VxpJp6289JlhwsaVl54gVDrDsvKgUKGq4ONZPwyCCw vbV6sfPrGbCQgSTNYQSVEQdBRwkmGO+qHH2FFwuAn1coeMkmZ6ogmJWbsqpSd+7M/srF O41qEwxDwovozYzXv+QAvRGbp9AA+XBBfv/KbueXSFdfSwpeNxrEp37PCYbQJufvsRD+ nTWhcacz3Y3HxqtYyRaKTOa+ogCAEul9SlhbZEekr6+gjzGzBWUQ/9myh+GW7kT2we5V XpVcE9W7ElhC5iLYlI7TYeBKEgUkEOYUIY9wNeOq/wI0mNRY/ruNoQt66M7c3pEBRQtj EVnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=qq2qsCg6nsnfJ/5/IAkAv4iEcFjs/+qPauNQL4TUhy0=; b=arUXg9+08tyVSWHA0SE7y8T4ANbY9gcRWD2G145lHGDV92MSkPAWfgarfVY0HikViB ajl+P6h40Hk5wPH91Wru/s1F0jOY6MevIV+jYBR8r5n+zRmafCp4nCGekEkN0sWMusaA 33LiK5tqo1yl2lgi9ZLNUrgHbBfQ5aQUQ+OH0bKARKy1G/cbZLfUMOFxdMYCoNhUUddb /0ACX5PiiJQFhmL2eGR64Lw9hLG7taAtSeCMKwxN8ZdezCDA8BdehDo4biNPUDIiig9s aS5IzIMLpu84w1R0/y3xIfKy93y4f4y4wxpKMCd/f3aqlM9jEd7ZMcMnXgAWTAzcpI2l cM5w== 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 d10si805590oti.226.2020.03.11.02.36.44; Wed, 11 Mar 2020 02:36:55 -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; 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 S1728845AbgCKJfT (ORCPT + 99 others); Wed, 11 Mar 2020 05:35:19 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:50522 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726934AbgCKJfT (ORCPT ); Wed, 11 Mar 2020 05:35:19 -0400 Received: from fsav106.sakura.ne.jp (fsav106.sakura.ne.jp [27.133.134.233]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 02B9Yu26088449; Wed, 11 Mar 2020 18:34:56 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav106.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav106.sakura.ne.jp); Wed, 11 Mar 2020 18:34:56 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav106.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 02B9YqIZ088382 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Mar 2020 18:34:56 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [patch] mm, oom: prevent soft lockup on memcg oom for UP systems To: David Rientjes Cc: Andrew Morton , Vlastimil Babka , Michal Hocko , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <0e5ca6ee-d460-db8e-aba2-79aa7a66fad1@I-love.SAKURA.ne.jp> From: Tetsuo Handa Message-ID: <7a6170fc-b247-e327-321a-b99fb53f552d@i-love.sakura.ne.jp> Date: Wed, 11 Mar 2020 18:34:49 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/03/11 7:55, David Rientjes wrote: > On Wed, 11 Mar 2020, Tetsuo Handa wrote: > >>> diff --git a/mm/vmscan.c b/mm/vmscan.c >>> --- a/mm/vmscan.c >>> +++ b/mm/vmscan.c >>> @@ -2637,6 +2637,8 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) >>> unsigned long reclaimed; >>> unsigned long scanned; >>> >>> + cond_resched(); >>> + >> >> Is this safe for CONFIG_PREEMPTION case? If current thread has realtime priority, >> can we guarantee that the OOM victim (well, the OOM reaper kernel thread rather >> than the OOM victim ?) gets scheduled? >> > > I think it's the best we can do that immediately solves the issue unless > you have another idea in mind? "schedule_timeout_killable(1) outside of oom_lock" or "the OOM reaper grabs oom_lock so that allocating threads guarantee that the OOM reaper gets scheduled" or "direct OOM reaping so that allocating threads guarantee that some memory is reclaimed". > >>> switch (mem_cgroup_protected(target_memcg, memcg)) { >>> case MEMCG_PROT_MIN: >>> /* >>> >>