From patchwork Sun Nov 19 19:47:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13460666 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 36C53C5AE5E for ; Sun, 19 Nov 2023 19:48:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B49466B0393; Sun, 19 Nov 2023 14:48:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AFA136B039B; Sun, 19 Nov 2023 14:48:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 974B86B039F; Sun, 19 Nov 2023 14:48:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7906F6B0393 for ; Sun, 19 Nov 2023 14:48:38 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 55AA3120796 for ; Sun, 19 Nov 2023 19:48:38 +0000 (UTC) X-FDA: 81475741116.20.09FA10C Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by imf23.hostedemail.com (Postfix) with ESMTP id 7345E14000F for ; Sun, 19 Nov 2023 19:48:36 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=M10LqNdb; spf=pass (imf23.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.172 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700423316; 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=C/w+GrPz4ktaqTeTQ4DmVKbN9IqMk3W+D3u9IVSxuMQ=; b=GpaaAEMbkxlNqor7f6prD+M1NOi6I8cjsONk+/snRcpgfaJ7x+4CCPMqek5vmGghqJAUQn 314Ms3+sk283CxcUYKpxBbgCPupq7DUyhjJZKLWPxjzLM4lg81Ht8QCUwjnQVCSczg8nK6 TfD2OLAepzlkScuQMq/+MMDA4F2IMcE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700423316; a=rsa-sha256; cv=none; b=LSCK+Ik04GGL1F8xVhar30NM87qMauKKByvEcH1vMJun6st7MnXrbV/OwlV2rb39EGXDIv VdqtaAmz2qcReoWIHhdFoPt7cPAyc/YkdhzfayPDwU8bsFhF7OmVs5K/TRtiuVVW1IBHM4 IXq0siouQKa0hfvlPGPaD2JWP4P8z94= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=M10LqNdb; spf=pass (imf23.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.172 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6cb7951d713so352284b3a.1 for ; Sun, 19 Nov 2023 11:48:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700423314; x=1701028114; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=C/w+GrPz4ktaqTeTQ4DmVKbN9IqMk3W+D3u9IVSxuMQ=; b=M10LqNdbRhkZQqx2fOldao6r3A/FbZmcaQnLP4rPejAHuAuyKLMJPw03hcVIEVuw05 K5ROliBQLzZ8jJ0ozUQER9GXK3GeFk+n70xCTlvk03HaTxIrWbKigxL+byj8eJ8ADmT/ 3jrky6LmAubACFEtA/J8HAy+nOczi9xcIR5jQHRj+ecwp18g+LgAIx4992oQnzo6T0ob Rk2NCl0x8MCm0IB6cAI/O735ylSbIpVLG5rCP5mPUsSceU0OajXqKE75KMGTitBQbqPV xQCJgpIXnwkzF6a/j4XOkbOAaKiM6TsbCbZsSSYO/rqW3WvmPxiddUykVijlk7L+iVfF Sl4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700423314; x=1701028114; h=content-transfer-encoding:mime-version:reply-to: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=C/w+GrPz4ktaqTeTQ4DmVKbN9IqMk3W+D3u9IVSxuMQ=; b=m+LXz6zJ3Nc92T+UrS88U5CG22wi225Qg8fLqwkCM4iaKkfAAJgCxypUzps+OHKRv0 /7T1c0HHxPehVBCXPpFPHeSSSQp4cR/A65RgCwnEwdFT1CTp/LMhr3lHuYDKigJAyQKy /HLEM1ZFUy5n23zuW0S3CSvwj+K4XKtYymdNdXeVV1+rwXOFIvoXk2kfIPAl3mkbDocb o507cFI8vXp1oknQ8mWOnrfeU+ZkZGjeAzEMbD19K0DJo2w2MOFCUHWFNXf700INTsRO 9Zji3+S0gVOKvJhWpBD/+HjIZ7xYwmQ1QS1w2FseaGoWmKo9jwGn7RfkCUa+9j9uABc9 EtlQ== X-Gm-Message-State: AOJu0Yx6F1EP+h1xagllcUJAvHHo+QYpdpVGXvaR/BSU/hv7aK1Lte8N rfuuD7cyyJ8an0BIVi9nhOhJBTYtgG9oFpy1 X-Google-Smtp-Source: AGHT+IEspsOv+B33e2KenQSEEY708IvBCJ1YaqljuBAeYVz5GS0a0k4ga/MiJ9KapiAUwb4LUSztpg== X-Received: by 2002:a05:6a00:2e99:b0:6c9:88ee:1d87 with SMTP id fd25-20020a056a002e9900b006c988ee1d87mr19403560pfb.17.1700423314274; Sun, 19 Nov 2023 11:48:34 -0800 (PST) Received: from KASONG-MB2.tencent.com ([115.171.40.79]) by smtp.gmail.com with ESMTPSA id a6-20020aa78646000000b006cb7feae74fsm1237140pfo.164.2023.11.19.11.48.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 19 Nov 2023 11:48:33 -0800 (PST) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , David Hildenbrand , Hugh Dickins , Johannes Weiner , Matthew Wilcox , Michal Hocko , linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH 10/24] mm/swap: remove nr_rotate_swap and related code Date: Mon, 20 Nov 2023 03:47:26 +0800 Message-ID: <20231119194740.94101-11-ryncsn@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231119194740.94101-1-ryncsn@gmail.com> References: <20231119194740.94101-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: 7hre4h95qadg5xhicriwrwxbkrj79iep X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7345E14000F X-Rspam-User: X-HE-Tag: 1700423316-107635 X-HE-Meta: U2FsdGVkX1+JnSR7VNBkZNGjQ/JYX2vNxRvKE6EDiF2ZENWvB2WhK/mUhJDawOV8GAd1+Kjqu38Q4lPDxWCN7RlR2R9rqBuq4htmfFXMbjcrgF70DXwDW6NoLdBwXoc6e6WvfFWwM5j6x8eFY3WPBAx8Z91Lhq8xOKm6J/AUCmRevJsxpLVpQTO41FeA+pXVRv/W7p4f6P+NEoM07hhCzHDzlMjSHZFTZfngfxO/I6VtiGkgQawGR+SoIXRhrxXQg9/hO1Hwbw+BLhgvSwVXwDeD6caXoNCUXocFgnzLQbrD+LD8cQYu+QIixJqJhN3o9FEdAwlhQXIZhxp06Z5hihVNqc4iwXxhkroEWEF54453/hr5BW8xBR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U81RcKdrTyRYxB3N4WZgL6nVWOFPZxKz47NP3vuTbWy0ihsHkXbKBE7TmpqEcLar9cHckUKsTOu1eXTTA9nDMZV0n4nXa7CuUDkl67dxftTcEqlR8oxBxO1mWUYcM2q/Od44AB2AYE4dImeKH6PnSdr0nlOPAKKUI2EKiCFkW/jgapqKz9BUUaXvicbM/hqvK4ClJ1XKo1V5utWd0QJre0t4249tQo= 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: List-Subscribe: List-Unsubscribe: From: Kairui Song No longer needed after we switched to per entry swap readhead policy. Signed-off-by: Kairui Song --- include/linux/swap.h | 1 - mm/swapfile.c | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 64a37819a9b3..cc83fb884757 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -454,7 +454,6 @@ extern void free_pages_and_swap_cache(struct encoded_page **, int); /* linux/mm/swapfile.c */ extern atomic_long_t nr_swap_pages; extern long total_swap_pages; -extern atomic_t nr_rotate_swap; extern bool has_usable_swap(void); /* Swap 50% full? Release swapcache more aggressively.. */ diff --git a/mm/swapfile.c b/mm/swapfile.c index e15a6c464a38..01c3f53b6521 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -104,8 +104,6 @@ static DECLARE_WAIT_QUEUE_HEAD(proc_poll_wait); /* Activity counter to indicate that a swapon or swapoff has occurred */ static atomic_t proc_poll_event = ATOMIC_INIT(0); -atomic_t nr_rotate_swap = ATOMIC_INIT(0); - static struct swap_info_struct *swap_type_to_swap_info(int type) { if (type >= MAX_SWAPFILES) @@ -2486,9 +2484,6 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) if (p->flags & SWP_CONTINUED) free_swap_count_continuations(p); - if (!p->bdev || !bdev_nonrot(p->bdev)) - atomic_dec(&nr_rotate_swap); - mutex_lock(&swapon_mutex); spin_lock(&swap_lock); spin_lock(&p->lock); @@ -2990,7 +2985,6 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) struct swap_cluster_info *cluster_info = NULL; struct page *page = NULL; struct inode *inode = NULL; - bool inced_nr_rotate_swap = false; if (swap_flags & ~SWAP_FLAGS_VALID) return -EINVAL; @@ -3112,9 +3106,6 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) cluster = per_cpu_ptr(p->percpu_cluster, cpu); cluster_set_null(&cluster->index); } - } else { - atomic_inc(&nr_rotate_swap); - inced_nr_rotate_swap = true; } error = swap_cgroup_swapon(p->type, maxpages); @@ -3218,8 +3209,6 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) spin_unlock(&swap_lock); vfree(swap_map); kvfree(cluster_info); - if (inced_nr_rotate_swap) - atomic_dec(&nr_rotate_swap); if (swap_file) filp_close(swap_file, NULL); out: