From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751363AbdGQI4K (ORCPT ); Mon, 17 Jul 2017 04:56:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:58678 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751289AbdGQI4J (ORCPT ); Mon, 17 Jul 2017 04:56:09 -0400 Date: Mon, 17 Jul 2017 10:56:05 +0200 From: Michal Hocko To: Tetsuo Handa Cc: linux-mm@kvack.org, hannes@cmpxchg.org, rientjes@google.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/page_alloc: Wait for oom_lock before retrying. Message-ID: <20170717085605.GE12888@dhcp22.suse.cz> References: <1500202791-5427-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1500202791-5427-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun 16-07-17 19:59:51, Tetsuo Handa wrote: > Since the whole memory reclaim path has never been designed to handle the > scheduling priority inversions, those locations which are assuming that > execution of some code path shall eventually complete without using > synchronization mechanisms can get stuck (livelock) due to scheduling > priority inversions, for CPU time is not guaranteed to be yielded to some > thread doing such code path. > > mutex_trylock() in __alloc_pages_may_oom() (waiting for oom_lock) and > schedule_timeout_killable(1) in out_of_memory() (already held oom_lock) is > one of such locations, and it was demonstrated using artificial stressing > that the system gets stuck effectively forever because SCHED_IDLE priority > thread is unable to resume execution at schedule_timeout_killable(1) if > a lot of !SCHED_IDLE priority threads are wasting CPU time [1]. I do not understand this. All the contending tasks will go and sleep for 1s. How can they preempt the lock holder? -- Michal Hocko SUSE Labs