From patchwork Wed Oct 26 13:48:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13020652 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8623C433FE for ; Wed, 26 Oct 2022 13:49:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 328F28E0002; Wed, 26 Oct 2022 09:49:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B2448E0001; Wed, 26 Oct 2022 09:49:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 152878E0002; Wed, 26 Oct 2022 09:49:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 035998E0001 for ; Wed, 26 Oct 2022 09:49:27 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CF568405C6 for ; Wed, 26 Oct 2022 13:49:26 +0000 (UTC) X-FDA: 80063232732.20.DA01080 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf16.hostedemail.com (Postfix) with ESMTP id 2E9D1180035 for ; Wed, 26 Oct 2022 13:49:25 +0000 (UTC) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666792163; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=J6fdA2PuNf7lAKCg4xeCD6LMsriAUCedCbXOb0fH3no=; b=Xfu1AhiG5mM50qHXxgKR5zxDonMaJjNja7V8PdW8xZ1QLKGnTXQ1cNXw8/50Fblm8SrfCj Nwd1vL/H+OL8NZMQfnwWEEqJjeNWI3Cd9AsgIOpeKEl+ydDMyC0CZHT28BanqMgz7q4vy0 /1kcFdeEsr+uCiXn0G/KwIdje029zhZ4vwbzUxhxrzWP+IdsBjoR1tBKGERkbAk/k5SFCB xZIHWAyb6q5sEkY3qjjYsyIVKH7VCauosAc4CwjJ6Dnfy47fSvzmvvTQtFasclDlby85zh 35YKTwSb/Ou3gnT356zqMXy6i7zShGBI4UZHFjACGcB/qJbJa7OjYlF9HcHEuQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666792163; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=J6fdA2PuNf7lAKCg4xeCD6LMsriAUCedCbXOb0fH3no=; b=DzOoRUCi24YEy0pYcWsZar/4gotUFL4lx0JK0RgQDP666u+uSENZXto66B5Z864gLU2Jzn ACHXovuDmTI12vBQ== To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: Alexander Viro , Eric Biederman , Kees Cook , Yu Zhao , Andrew Morton , Thomas Gleixner , Sebastian Andrzej Siewior Subject: [PATCH] mm: multi-gen LRU: Move lru_gen_add_mm() out of IRQ-off region. Date: Wed, 26 Oct 2022 15:48:30 +0200 Message-Id: <20221026134830.711887-1-bigeasy@linutronix.de> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666792166; a=rsa-sha256; cv=none; b=qvMcKBvvLe0jzhP+KIwFWQFjW23ATiekX8hJYbk8S3EzAu97SRFVXMB6XHlc5vGHUKuTEz b3cGCTyxiId/eB47ocoMCkTwmzFhVJqK7i50Djhlgbdfrie/4KD3NjAF7GGrE5hFh0VKwk 3ngOPRb5XDwcuXlFNpRvDhRVTphNsM0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=Xfu1AhiG; dkim=pass header.d=linutronix.de header.s=2020e header.b=DzOoRUCi; spf=pass (imf16.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666792166; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=J6fdA2PuNf7lAKCg4xeCD6LMsriAUCedCbXOb0fH3no=; b=AXMN0RvSw6ypgxpX9IxuKdA9vXeCINM6VHmrmX7Tu/unJ5cZM1sCRzbcW/LxQ7zs2QZZjX YYHrtU2TmNjoF5fKBFqY70w+oQjY7NCQGh/K6ByyM2UyO9BiSJuBakAz0IiSCyObH5+qqS I6V7+GJLzxTzm1tOb7sU5fPNznyHI6Q= X-Stat-Signature: 8h5oqjbcsb94oe1btxbzmm7e5isjzd68 X-Rspamd-Queue-Id: 2E9D1180035 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=Xfu1AhiG; dkim=pass header.d=linutronix.de header.s=2020e header.b=DzOoRUCi; spf=pass (imf16.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1666792165-253370 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: lru_gen_add_mm() has been added within an IRQ-off region in the commit mentioned below. The other invocations of lru_gen_add_mm() are not within an IRQ-off region. The invocation within IRQ-off region is problematic on PREEMPT_RT because the function is using a spin_lock_t which must not be used within IRQ-disabled regions. The other invocations of lru_gen_add_mm() occur while task_struct::alloc_lock is acquired. Move lru_gen_add_mm() after interrupts are enabled and before task_unlock(). Fixes: bd74fdaea1460 ("mm: multi-gen LRU: support page table walks") Signed-off-by: Sebastian Andrzej Siewior Acked-by: Yu Zhao --- fs/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/exec.c +++ b/fs/exec.c @@ -1012,7 +1012,6 @@ static int exec_mmap(struct mm_struct *m active_mm = tsk->active_mm; tsk->active_mm = mm; tsk->mm = mm; - lru_gen_add_mm(mm); /* * This prevents preemption while active_mm is being loaded and * it and mm are being updated, which could cause problems for @@ -1025,6 +1024,7 @@ static int exec_mmap(struct mm_struct *m activate_mm(active_mm, mm); if (IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM)) local_irq_enable(); + lru_gen_add_mm(mm); task_unlock(tsk); lru_gen_use_mm(mm); if (old_mm) {