Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4086192imm; Mon, 30 Jul 2018 08:26:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdwjSclVr+nRAWvZnui2raU1kvmmftzUHQBGC5pf59LvUAmmhW0gMUDovTNsyhrrDL4vvYZ X-Received: by 2002:a63:cd4c:: with SMTP id a12-v6mr8374616pgj.15.1532964381404; Mon, 30 Jul 2018 08:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532964381; cv=none; d=google.com; s=arc-20160816; b=furk7efNnORkQ0oVTGQc0F9BYGijhEusPqBYJyfB3EklMmQPSybYdd9J8eSCSvlzl/ h7w17MXTDzvxCxCEAjF9DghFYQbnBA+MXRQAes1QyAb8EVIX/rU6GRzJWhhAluR/FfFD RUZDo/18O/PCTmbRXIBW5UO+HB7GsSvF7upNBHpTUgSVkeb4SYGKCF11dITT4cIlF1Uf SYfGMgYn6cqjZve2k0yABbFTQPPkS0UIQbclbwuK2tnKuT1K/oIQB9NTXq2Wh1xyv88Z ZqcjnLt34kQwkNASG+xd+efTLN4ucOKNMebkgN0i8UbXPpQ3uu7wuJOqlH5Da2XPZ8iI iYng== 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:arc-authentication-results; bh=n1gy1gXjBRK9/UPdBILHt2N5kToteiwsCJK3c4pRKoM=; b=vks10EDUUSBe1hPydoBIhkFE7ZNQHwaGT6B3CgJzjg7ZY8f56MpT88GPM99th9cvVI BktcRNBOWnn0jEllnLp2ayucHLsJnk7ApaVcGco7hem0szn+GAngyW7omxqGnTEnvp0A tLbma+sMX2FBYutm3FiLD4l8+JfotLlWGVqh0yGb3syhUGG9AsR1Z18HF0nxWuxPV7fC tLb2vWMrtiTsv5SmSfYG7VToQ7jUEAacrD+oD82h5QT0M3d4rq2LLln54zsDBp4nAupI xpLY8l2XChVF5LLuP1cMmTtzQ+TOqeMdv898lUiJXm3FZ9EXLclb4alOsYw+OKVO7QPf OOvQ== 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 m76-v6si11258344pfg.323.2018.07.30.08.26.06; Mon, 30 Jul 2018 08:26:21 -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 S1726816AbeG3RAj (ORCPT + 99 others); Mon, 30 Jul 2018 13:00:39 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:42592 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726663AbeG3RAj (ORCPT ); Mon, 30 Jul 2018 13:00:39 -0400 Received: from fsav301.sakura.ne.jp (fsav301.sakura.ne.jp [153.120.85.132]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w6UFP949000877; Tue, 31 Jul 2018 00:25:09 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav301.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav301.sakura.ne.jp); Tue, 31 Jul 2018 00:25:09 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav301.sakura.ne.jp) Received: from [192.168.1.8] (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w6UFP8jW000868 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Jul 2018 00:25:08 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH] mm,page_alloc: PF_WQ_WORKER threads must sleep at should_reclaim_retry(). To: Tejun Heo , Michal Hocko Cc: Roman Gushchin , Johannes Weiner , Vladimir Davydov , David Rientjes , Andrew Morton , Linus Torvalds , linux-mm , LKML References: <20180726113958.GE28386@dhcp22.suse.cz> <55c9da7f-e448-964a-5b50-47f89a24235b@i-love.sakura.ne.jp> <20180730093257.GG24267@dhcp22.suse.cz> <9158a23e-7793-7735-e35c-acd540ca59bf@i-love.sakura.ne.jp> <20180730144647.GX24267@dhcp22.suse.cz> <20180730145425.GE1206094@devbig004.ftw2.facebook.com> From: Tetsuo Handa Message-ID: <0018ac3b-94ee-5f09-e4e0-df53d2cbc925@i-love.sakura.ne.jp> Date: Tue, 31 Jul 2018 00:25:04 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180730145425.GE1206094@devbig004.ftw2.facebook.com> 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 2018/07/30 23:54, Tejun Heo wrote: > Hello, > > On Mon, Jul 30, 2018 at 04:46:47PM +0200, Michal Hocko wrote: >> On Mon 30-07-18 23:34:23, Tetsuo Handa wrote: >>> On 2018/07/30 18:32, Michal Hocko wrote: >> [...] >>>> This one is waiting for draining and we are in mm_percpu_wq WQ context >>>> which has its rescuer so no other activity can block us for ever. So >>>> this certainly shouldn't deadlock. It can be dead slow but well, this is >>>> what you will get when your shoot your system to death. >>> >>> We need schedule_timeout_*() to allow such WQ_MEM_RECLAIM workqueues to wake up. (Tejun, >>> is my understanding correct?) Lack of schedule_timeout_*() does block WQ_MEM_RECLAIM >>> workqueues forever. >> >> Hmm. This doesn't match my understanding of what WQ_MEM_RECLAIM actually >> guarantees. If you are right then the whole thing sounds quite fragile >> to me TBH. > > Workqueue doesn't think the cpu is stalled as long as one of the > per-cpu kworkers is running. The assumption is that kernel threads > are not supposed to be busy-looping indefinitely (and they really > shouldn't). WQ_MEM_RECLAIM guarantees that "struct task_struct" is preallocated. But WQ_MEM_RECLAIM does not guarantee that the pending work is started as soon as an item was queued. Same rule applies to both WQ_MEM_RECLAIM workqueues and !WQ_MEM_RECLAIM workqueues regarding when to start a pending work (i.e. when schedule_timeout_*() is called). Is this correct? > We can add timeout mechanism to workqueue so that it > kicks off other kworkers if one of them is in running state for too > long, but idk, if there's an indefinite busy loop condition in kernel > threads, we really should get rid of them and hung task watchdog is > pretty effective at finding these cases (at least with preemption > disabled). Currently the page allocator has a path which can loop forever with only cond_resched(). > > Thanks. >