From patchwork Fri Nov 5 20:40:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12605601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A26DC433EF for ; Fri, 5 Nov 2021 20:40:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 084B061279 for ; Fri, 5 Nov 2021 20:40:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 084B061279 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9B36D940073; Fri, 5 Nov 2021 16:40:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9620D940049; Fri, 5 Nov 2021 16:40:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85136940073; Fri, 5 Nov 2021 16:40:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id 6FB15940049 for ; Fri, 5 Nov 2021 16:40:54 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3AF3655D92 for ; Fri, 5 Nov 2021 20:40:54 +0000 (UTC) X-FDA: 78776045628.18.6EBAC23 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf11.hostedemail.com (Postfix) with ESMTP id E1118F0000B0 for ; Fri, 5 Nov 2021 20:40:53 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id EDC1661262; Fri, 5 Nov 2021 20:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636144853; bh=kRVAicR0RFgPFMeoHCQB41ZDmeTS5LoBsuX8BL9G2Hc=; h=Date:From:To:Subject:In-Reply-To:From; b=B4PjbjfbxO/+w4CIcqtNASyrqv8uh3sRp60VN+FZ8ZjPYJdzkIp2Tuo3+skNO4jiI EudpciNS5BHW6mKYFgiKI5vonNF7j+YnltqPQEIAof73hr2tpDtzj29P8Fik5eb3OM ybvNE80xKW3tdw5x5dg49PzRNQrMbUPek6xKaoME= Date: Fri, 05 Nov 2021 13:40:52 -0700 From: Andrew Morton To: akpm@linux-foundation.org, bigeasy@linutronix.de, linux-mm@kvack.org, mm-commits@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, torvalds@linux-foundation.org Subject: [patch 119/262] mm: page_alloc: use migrate_disable() in drain_local_pages_wq() Message-ID: <20211105204052.cwfJA8ksK%akpm@linux-foundation.org> In-Reply-To: <20211105133408.cccbb98b71a77d5e8430aba1@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=B4Pjbjfb; dmarc=none; spf=pass (imf11.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E1118F0000B0 X-Stat-Signature: w7h1sgx6za9f19z3u16ks9ehjcawamyb X-HE-Tag: 1636144853-622513 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Sebastian Andrzej Siewior Subject: mm: page_alloc: use migrate_disable() in drain_local_pages_wq() drain_local_pages_wq() disables preemption to avoid CPU migration during CPU hotplug and can't use cpus_read_lock(). Using migrate_disable() works here, too. The scheduler won't take the CPU offline until the task left the migrate-disable section. The problem with disabled preemption here is that drain_local_pages() acquires locks which are turned into sleeping locks on PREEMPT_RT and can't be acquired with disabled preemption. Use migrate_disable() in drain_local_pages_wq(). Link: https://lkml.kernel.org/r/20211015210933.viw6rjvo64qtqxn4@linutronix.de Signed-off-by: Sebastian Andrzej Siewior Cc: Thomas Gleixner Cc: Peter Zijlstra Signed-off-by: Andrew Morton --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/page_alloc.c~mm-page_alloc-use-migrate_disable-in-drain_local_pages_wq +++ a/mm/page_alloc.c @@ -3141,9 +3141,9 @@ static void drain_local_pages_wq(struct * cpu which is alright but we also have to make sure to not move to * a different one. */ - preempt_disable(); + migrate_disable(); drain_local_pages(drain->zone); - preempt_enable(); + migrate_enable(); } /*