From patchwork Fri Oct 15 21:09:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12562793 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 38F22C433EF for ; Fri, 15 Oct 2021 21:09:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AC6C1611C3 for ; Fri, 15 Oct 2021 21:09:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AC6C1611C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 154216B006C; Fri, 15 Oct 2021 17:09:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 104A86B0072; Fri, 15 Oct 2021 17:09:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F35236B0073; Fri, 15 Oct 2021 17:09:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id DFACE6B006C for ; Fri, 15 Oct 2021 17:09:36 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9866839F31 for ; Fri, 15 Oct 2021 21:09:36 +0000 (UTC) X-FDA: 78699913152.17.274BAE8 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf11.hostedemail.com (Postfix) with ESMTP id 47A3AF0000AA for ; Fri, 15 Oct 2021 21:09:36 +0000 (UTC) Date: Fri, 15 Oct 2021 23:09:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634332174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=GP5y2970UpUA7/KAZxi5xi4KL/Wd1fHnep74wFJtoo8=; b=R/adU/AP5+IPp3hJedz4KN9QMal/ubIr4I2hysQ1u1RSMkecslKsu1JvLc6cn4PXPnFmuv Ut/lKQ9ZcGwkG2t1OzK5OXceJeDRsepurwCeHAQ7f0YiG3huE1Wty+3PwUQAb1Dg+VHims SBarqVX4ajSkSBcikOxdrAsQhNzBUds4CAMHCjeaucwK6lZN/Z9Ra1FMZMRKM6ZV3L28VF EKWdlyzTe5x/LOyC+Uhc0uFZW+kyo5CnuMEN74zuNzA9LetsE5HMT/8jNrdGVZAfXnXQpl 6DryPUHB7fBbtKKTQ0vfrJpBcN30X8DLsBWCN9EkOCIzx/DaWxnZYQvkmSIXSA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634332174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=GP5y2970UpUA7/KAZxi5xi4KL/Wd1fHnep74wFJtoo8=; b=dGq5rRVgp8SnfxLZhHDi9kUeq0X9Vl6vQabmZQNX4pJVY2ul0FQKqHL9TtRbJOgbocWydw PJcwlF4jYLCavsAg== From: Sebastian Andrzej Siewior To: linux-mm@kvack.org Cc: Andrew Morton , Thomas Gleixner , Peter Zijlstra Subject: [PATCH] mm: page_alloc: Use migrate_disable() in drain_local_pages_wq() Message-ID: <20211015210933.viw6rjvo64qtqxn4@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 47A3AF0000AA X-Stat-Signature: a6af4bj1gtx3h7gjh5k18cu9eyzadms3 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="R/adU/AP"; dkim=pass header.d=linutronix.de header.s=2020e header.b=dGq5rRVg; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf11.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de X-HE-Tag: 1634332176-158057 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: 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(). Signed-off-by: Sebastian Andrzej Siewior --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3147,9 +3147,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(); } /*