From patchwork Thu Sep 22 01:12:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 12984357 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 8D295C6FA8E for ; Thu, 22 Sep 2022 01:13:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD9E18000B; Wed, 21 Sep 2022 21:13:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A62B780007; Wed, 21 Sep 2022 21:13:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83FD48000B; Wed, 21 Sep 2022 21:13:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6818480007 for ; Wed, 21 Sep 2022 21:13:00 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3543E14133E for ; Thu, 22 Sep 2022 01:13:00 +0000 (UTC) X-FDA: 79937947320.11.8EFC3CE Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by imf06.hostedemail.com (Postfix) with ESMTP id E4EC718001B for ; Thu, 22 Sep 2022 01:12:59 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 94EF55C0151; Wed, 21 Sep 2022 21:12:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 21 Sep 2022 21:12:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to :reply-to:sender:subject:subject:to:to; s=fm2; t=1663809179; x= 1663895579; bh=qknF5tcmy+B2CeTlFoEm9W1xIUxKlOolFzMt14jmfpk=; b=X 2bHIeLYGPhTCPgQDwNnhPXIt7MWjcmMCp5OZlT5Mkm1hwHTtIYOmhhbvBieCR2yv q3SIY3EojmIMybIMbpb2TbtdtHpVmAqudy1+WlKTAhPVj+ID2hiclyag1lu/20ZH 7uHC/UM84HyHFhP7ynvU21zoJ6I3LRzuQ4PtCVKEGH06hM93mc9d9Gd9WYZ7CuIe WXlQUwqxKDZjl1BG4x2M114vZ2zfvcs1LDkLhzDirl+qFkSEsHybRnJDpDlSxaFD waoQM8AM5KSyj4asoHtK4OqmtjaY2pS54OBbBP6Q5x7FM+szqG5zo7YA8wObOG8s T3rQEqILXpkiz/nglpygg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1663809179; x=1663895579; bh=q knF5tcmy+B2CeTlFoEm9W1xIUxKlOolFzMt14jmfpk=; b=Mk7vLLrcqb21dqzZS mmBHP6QqHTSiDjdqwagKJmEE+MDzrCh/m1bOcoJqTg4rm5jSgxOoWwHynF8QRfhY 05Bw4XyuEEscpaGL26H3lyMmqa3aATo5Q+jEypMQQh2QgYhgWx23C4h2DiR9b5uu 8jz2JW2gKKuEXz6qVRcOTVzJ6D0cd4584SY7Qwnx+NO4HYVtPOQe90HK9HO++8AU ADkUgyFMJg4XozOd1dWNNP1jTlrCWkkKBr4J7e4M/uBG6wkybp4n+y04I85ERQ3l onFNvIy7Vh6iUyxKD+MYI7uGfihdCGLDHD9bE11uEevG7TyHELtqNw+rUWM1UxxM 1Jr4Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefvddggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhhrggfgsedtqhertdertddtnecuhfhrohhmpegkihcu jggrnhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeegge ehudfgudduvdelheehteegledtteeiveeuhfffveekhfevueefieeijeegvdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeiiihdrhigrnhessh gvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Sep 2022 21:12:57 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org Cc: Zi Yan , David Hildenbrand , Matthew Wilcox , Vlastimil Babka , "Kirill A . Shutemov" , Mike Kravetz , John Hubbard , Yang Shi , David Rientjes , James Houghton , Mike Rapoport , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org Subject: [PATCH v1 05/12] fs: proc: use pageblock_nr_pages for reschedule period in read_kcore() Date: Wed, 21 Sep 2022 21:12:45 -0400 Message-Id: <20220922011252.2266780-6-zi.yan@sent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220922011252.2266780-1-zi.yan@sent.com> References: <20220922011252.2266780-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b="X 2bHIeL"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=Mk7vLLrc; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf06.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.26 as permitted sender) smtp.mailfrom=zi.yan@sent.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663809179; a=rsa-sha256; cv=none; b=hAVkbf8y1htzgeBebwQKFpOX5lXD9+DTJmw5twg24+KAhm4I7648eW4xETyO6/uaXc5ROQ n0n0yFbOZTRaJ4I2xd3ok25sobAT32LN2gcCeyUhCA104oAP/YWL62s0xFewrDDf9xH39V 5fkJm7HGtjuRPt87laCmjWX1KV0pyVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663809179; h=from:from:sender:reply-to: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=qknF5tcmy+B2CeTlFoEm9W1xIUxKlOolFzMt14jmfpk=; b=LhTZ+r4EaMSQOEx3RTo40iZnafOstmXuBlfUFobwXxs+m47JqiVspGy3zhFEaPqLKmi1Yu dygobgUGZmEFuTtcMQvS36uDN0R11C/jH3lenyZRfH41Cgde5SZidn5a1Yb2PvvpkYORrF 6A9+TFFGkHVcSB8O+fgcOWBWZqgE7nI= Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b="X 2bHIeL"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=Mk7vLLrc; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf06.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.26 as permitted sender) smtp.mailfrom=zi.yan@sent.com X-Rspamd-Server: rspam06 X-Stat-Signature: gq9itf9tia8iuzk8xhbqyfo1wjs15y5e X-Rspam-User: X-Rspamd-Queue-Id: E4EC718001B X-HE-Tag: 1663809179-425086 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: Zi Yan MAX_ORDER_NR_PAGES can be increased when it becomes a boot time parameter in later commits. To make sure read_kcore() reschedule its work in a constant period, use pageblock_nr_pages instead for reschedule period, since pageblock_nr_pages is a constant and either the same or half of MAX_ORDER_NR_PAGES. Reviewed-by: David Hildenbrand Signed-off-by: Zi Yan Cc: Mike Rapoport Cc: David Hildenbrand Cc: Oscar Salvador Cc: Ying Chen Cc: Feng Zhou Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- fs/proc/kcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index dff921f7ca33..7dc09d211b48 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -491,7 +491,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) } } - if (page_offline_frozen++ % MAX_ORDER_NR_PAGES == 0) { + if (page_offline_frozen++ % pageblock_nr_pages == 0) { page_offline_thaw(); cond_resched(); page_offline_freeze();