Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1822899rdb; Sun, 19 Nov 2023 11:51:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEesyibqC/r2LUDuH1PbDV+zB9ud6VqcCjHKMgtiBtNEmSRlz9grkGiJ6U30T2zHsU7ByYL X-Received: by 2002:a05:6a20:8e08:b0:187:a884:ec45 with SMTP id y8-20020a056a208e0800b00187a884ec45mr15882613pzj.21.1700423517611; Sun, 19 Nov 2023 11:51:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700423517; cv=none; d=google.com; s=arc-20160816; b=PF92HnIlN9E98ppJYDfMr8tZzgScpwKmCySm9UoaaWsfd3zp9S16/mcjuVyvBPjErR Da9idZqECJzCyYnzpwEAnOzzAg0LZbBKhm6VAuQc/cbHRat0x2TAhWICBwF3IlQZEIpI NRI0z15NbWFJh4tlCh1nFm9+h5BhH/Ey/ZPNdv4PZEabstiCFI/i0c7rhj8kzTSW6FG9 RObfr/YAl54Sx2JjFwN64Mj/ATJkz3ohHG/Cwmy8XqHwAWr0dglQQx3mrlJL3AYqWcrm 76vzP8U8J9HBc2nfBicIFskJ1tgFNpU2H0IA+HBUQTUwpdgKXyHWcYtFXg+5LWXhx/s4 f5Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:reply-to :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C/w+GrPz4ktaqTeTQ4DmVKbN9IqMk3W+D3u9IVSxuMQ=; fh=4HE/piJoUCKuBTCCBiej4//zvvzywHdOLL9QM/KYjYM=; b=get6FQJNCwvgoQCQqiCUa+kafTTjLEekUfWcdM3B9YLb8bjBWcfKwG1Kkgyey+w2Kt RJqGYFFMw4ZViJnHkoeaQDzCT99udLjgi0v986nHBb/Trd2T1tIDM+5+yRFgTaSqZBzm kqOb0/1E+5KsYQ22Le+2Rgt7uNQZmhj8DOwT9T6g9aq/tqs0vCVKE2cA7Sp+xc7/GJG2 cIoY/4svm1hB+R/yj9jgqodwsixfQoDV4cadhRDi0BjbVx15A6uJE8PInYg7CNXJlVku eXAdBzZUJzDuFicYCTd+rdBR4zTARTkrgSySInZCV5SfcvqQtcWFUAK/1hf9VxrqoR2d C7Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hWeuClbw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u23-20020a634557000000b005bdff99b465si6474560pgk.506.2023.11.19.11.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 11:51:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hWeuClbw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 3EB198080E08; Sun, 19 Nov 2023 11:51:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231805AbjKSTtK (ORCPT + 99 others); Sun, 19 Nov 2023 14:49:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231670AbjKSTsx (ORCPT ); Sun, 19 Nov 2023 14:48:53 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC189D7A for ; Sun, 19 Nov 2023 11:48:34 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6cb7951d713so352280b3a.1 for ; Sun, 19 Nov 2023 11:48:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700423314; x=1701028114; darn=vger.kernel.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=hWeuClbwt9dh9tON8JEyhbawHTrAbClV9oMYSRZp+VU1ZqxrXjtOSlT5yTqQ2SwFr1 bFG9WkEqFygF8GH4CsSzOhyaq5QiUjeUN9w6BKZs8ne0PaC8LxqNd1d6FLPJa5MnUEPX SucgF4XXsth99wKI0POSRLrdtijBlSgrqPvjvBlPgg7ZWy/L+ZDWDYFxYbYtZ0WX3r9o mDS4IosmsloEDJu7no+e+KllNv6tR6c9p/+zcABzir6eL5XcH5BoKz4ngTYdmt8wXvQq rIiWHerw3FOjOrdZq9A/sk1/OpwVCgo3g3RsRtEZxN+NQ7eXyGUT3mx45HF+FWKL0x5o abfw== 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=U0JYih8qxa8GHrkBp8HIf1dn4UH+tUajW6JwYTUtXBqKtzS85GFcio0kxGrlnGgoJC YpLE5pRL2wzPczaC+TZfAtiUV0GrICS7uyO4nirBPaPqBwTmtqIrRWDUvvUGBHU4+vi5 P3Fo+jcX0q3uGaOyben5T00KSEITXYApPuPpb9m0P4Xm4LlinNUy4xAb4GyUNeu4Fbcc fb2l48Da/H9zj8jlRS5wh4v8b0DDuPAD68Wo57h1t276aOXA1etAz0G2E7/uNVUvRUtm QX8TJKm8bcfZKrV1lBO0YbEi4Knhsd9xu4k/0Aerlk0fWrdpmdP3MI/yXQk3kZjgspeT 4qTg== X-Gm-Message-State: AOJu0YwzhEngVfgAyDJAbUxtRXijO2ErFEkjRRQTk1oRce7TMSSahzVq kCviY83GJsS11m0f3WsxQow= 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 19 Nov 2023 11:51:45 -0800 (PST) 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: -- 2.42.0