From patchwork Fri Jan 26 03:25:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13531958 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 B6D77C47258 for ; Fri, 26 Jan 2024 03:26:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D0346B0087; Thu, 25 Jan 2024 22:26:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4806C6B0088; Thu, 25 Jan 2024 22:26:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36FEA6B0089; Thu, 25 Jan 2024 22:26:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2943F6B0087 for ; Thu, 25 Jan 2024 22:26:21 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0B827160586 for ; Fri, 26 Jan 2024 03:26:21 +0000 (UTC) X-FDA: 81720024162.22.B663A94 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf03.hostedemail.com (Postfix) with ESMTP id 427372000C for ; Fri, 26 Jan 2024 03:26:19 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=G4ARmZHv; spf=pass (imf03.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.171 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706239579; 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:in-reply-to:references:references:dkim-signature; bh=3jyTAA0Yise+07ysJFEZh9UL4F2WjZvgNafE+3erLkY=; b=FTrlms3gVTwZTEsCJXm+OHd8WeFK8uOrcwLb1e3Xcd5K/gUcBaZc8p0sU4xAZZa1TfL+8k kouTBBWO+OSCsWprj7NAm2Z0YsHhJsArp0J5UpvYCvy+vBX4AAgu5ul50ejrhSS4rS8vBZ eSL6xAmt47nQWYnGMSf3fZ7N1BBMpLI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706239579; a=rsa-sha256; cv=none; b=7yKa2i/51J0FI+WKlzwl6BILUyvrH3A92LCKUVmOG6gle7ZWNjkYFhpt+Q7c7cfgkIqR1c eeFtl/pvyTitzf7aAZBwK26QpIAO7CeSSL1LJe1OPb4gvJLQPV2e/ObFMRfaoHRMM0fXrt y9qpSyhEddesVOwiJIq4f+vzd30OTlg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=G4ARmZHv; spf=pass (imf03.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.171 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1d51ba18e1bso726815ad.0 for ; Thu, 25 Jan 2024 19:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706239578; x=1706844378; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3jyTAA0Yise+07ysJFEZh9UL4F2WjZvgNafE+3erLkY=; b=G4ARmZHvNYLhNy6ZFsnsp2LDUI/AaFVIUDy99E0b6vw/oC5f7d5DZwiXLwsXuTVDro /qrm3z/ckfsXISo3tizJbzkqXfN2uEXMVRR9ABimJA80olAI6lvYEr+me2iTwrb3nyZA /H/JFYf7fpGGCtJ5lt+d4WVBw2QWRSJpBhmsg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706239578; x=1706844378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3jyTAA0Yise+07ysJFEZh9UL4F2WjZvgNafE+3erLkY=; b=FeWCnb+rN1014GqkDeZGR4KgWH4UFQ0UzzrFm95W9b+QJl6Co9v6Q7Knz6N/Uj19G4 N1lNBRFpfhYHLCDRLajVQ4lq16tVxGtC6J942OrIKosAftcd7nH84gkEpauvcYi8MCre MiAIwHd6GffijdAXZG+ppgbbY+Tt+xDBP4ecIBQLT6rRZsCw1PKuAFWry/0t3LLlRVZq JLHQu7sPoEqNkBRFTEntflStDuVdErEMJ5z2XMa31aY5VdiX/ngT7tknPIw8BVhibwnf fgC5I3t/4tw517h3Xo46w3WbLEeSHOzSh8+/ZMdIWAD6bM8+6te+lM4BGf0l1Ktq5JQH KnWA== X-Gm-Message-State: AOJu0YwHuJoqwFVAEG1EdE6BQpgn/rewgd/tcobND/RAKHBj8mOf4JUY SRQp2fbAwh3VVMNc9HwAimjTnWWwDygNDMRghDiiNLqdwio/rjT/C+NNttfl8g== X-Google-Smtp-Source: AGHT+IGS1o6SNKbTQYJU+qYLOMbAf0ANP7+Yayqquxbg3aPg8iboXRe+7m+NQiLxPk7hXuxwZ0TJUQ== X-Received: by 2002:a17:903:2592:b0:1d7:204a:f7fe with SMTP id jb18-20020a170903259200b001d7204af7femr683927plb.61.1706239578064; Thu, 25 Jan 2024 19:26:18 -0800 (PST) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:c4a9:6453:1d67:60e8]) by smtp.gmail.com with ESMTPSA id jh19-20020a170903329300b001d7724c24besm219266plb.9.2024.01.25.19.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 19:26:17 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Jiexun Wang , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky Subject: [PATCH] mm/madvise: don't forget to leave lazy MMU mode in madvise_cold_or_pageout_pte_range() Date: Fri, 26 Jan 2024 12:25:48 +0900 Message-ID: <20240126032608.355899-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20230921174101.8e6271422a857af5414ce0a0@linux-foundation.org> References: <20230921174101.8e6271422a857af5414ce0a0@linux-foundation.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 427372000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: u4k6sxf4crsrhx654tw64i3efuhg3e67 X-HE-Tag: 1706239579-24624 X-HE-Meta: U2FsdGVkX18M+efKziCijaRonJTecoPVsjZwrlgBWHCTuo0OyaMj1jBgdh2qAOoFLWspjUw6BKunoWEAshC1kiXch/Jy2JzSi0nyDgby2Bm0yDPE5WLenoeSY8qYq4Bsai3maJaDOeBE8st1ka9eaD6hWvXrHrUYsVaM8sPe3tVhjPnvPuNbn6kLc+9sJLRctAgoM5DWRS+DshQp92XFaPVdq1a8xVHRczq+iVlqRBEGPdbl50bw0zXpV2RM/QaGG4SlcBJ/y8DfDr+cGFOyToDHzOTJVbI8A8yDmfFHe3+GzB7HUQZSnohbSuVGNZjEF0Lx4Pq2sAS+wY/MoMErjrXYpTkopPM+Tl8Nh7Tmh5Y76l6fyGL2wp0KA+CRrQ46J3YWIlzg2Hxw5moqOKrJsgYmz8rTX9K+ecPFVkFnbsKS0ax3aeD6s7qYc6fjV36KNYTHAIJQunhqhRwQamuHTYfqTyHM8egfLtmir8a77diTQJvdPbmYpvj1w7JIfDRCpEejUO+XALYgXRIebpdrBKqwFLrMkngG2lRHEK5dPLKUiCoh6wEnGp6ymIgky/8VKECYaAmtySXH7KO6hBkHPLQh1LEUJ0WLLnejgE4pi1T9SwdvAC1q/4rsjQDWvkwImxkXk+qE36Y5SiRG3sugqPNQYzg2SVBl8YiWTSsy1EFRrqfwat3bk1eWruj9kJzAGbax3Z6xu8+4dCuKB+l4ZSyd295qDHtVqf+7usUZWd8ZYFVOIMl1sx8iuHMawMnh4k6ppQWWySNgidc0IvRCCS1GUtV6JkBJJewixMHdt1PpdSu/NN6IK5iZUpyNL2LXb3mH8SIq4w2mURvw2IPt1mP+uQgw/4d8DmpwiDMTvCrZ3d4p1vTpblxOIV4bcA99HOJrdNxfUB2Kmdq130DYmW4ZFgxntP9EfQ+zwcZel4pto0f7+leQwUymRp8fwyUerawPDAg8sXRpMv/VzEU N26d5hNW ctecpuq5+09/o4Rdis0kx/jQHJHgURAT+z63FyvMmor7m2hUjtoE8I/kDyebYIKb7nEcCD7oKwxIOSjojjX+L5dir9FLLeHZEXuUJ8T2M8k4bnfOfqQ5a9rqmNztbl8/8CWGexJOTUoPq9yC2E/4m66P/xwog9TYdv9NiAgC7lykmL3QRvO+kF3QTFCqzIJ4Wp8T2bN+aKPhawTcQ6UrG4TkqTxI+UdI2hE0NC2xpKtLVBYTFy9lbYLFqvR84Z7GjzqiDlYjFyuhYIENvvEEiEsGa7etT5X/z2GfeienDZWZ7pHu6ISYNKRTGC9QNLmbmYzooD2Z+Gw0OgvSBc7b/YJKAWTj4Uj/WIgEpz1rk1y0XEwVxlXVP3VUwZUJ3xGZA8Of0MUz0TvA8WD6c0H86z8/TVGtVOA0e427ZLMvNq1hjhGnS6FTD1bb0ZgL/b97ahwmEU1SOQ3eCtjc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000290, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: We need to leave lazy MMU mode before unlocking. Fixes: b2f557a21bc8 ("mm/madvise: add cond_resched() in madvise_cold_or_pageout_pte_range()") Signed-off-by: Sergey Senozhatsky --- mm/madvise.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/madvise.c b/mm/madvise.c index 0f222d464254..127f0c7b69ac 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -451,6 +451,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, if (++batch_count == SWAP_CLUSTER_MAX) { batch_count = 0; if (need_resched()) { + arch_leave_lazy_mmu_mode(); pte_unmap_unlock(start_pte, ptl); cond_resched(); goto restart;