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: 166871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1810087vqn; Sun, 19 Nov 2023 11:50:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8n0giWbOq9DFF2ozbHMFayZK/joyXhTBBJ44tAtN6liuMRId/X4hb2bM04UqKq5JpJyQj X-Received: by 2002:a17:902:c941:b0:1cc:5ce4:f64b with SMTP id i1-20020a170902c94100b001cc5ce4f64bmr7810902pla.8.1700423409519; Sun, 19 Nov 2023 11:50:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700423409; cv=none; d=google.com; s=arc-20160816; b=ZbZmuyJKujsC2M422jgKDQVwGxaqXCh4DqWughzx84W6OabShMopPBw7WfNlg3d+4+ +7pvf2Qwfjl3FlkXaFaUxC7ojtIYEdry1eEPBhw/kGeEFyQrQw37Ymun5Vspfr7z1XlU WrxgsCNA27T9GASdR51p3bmR7+18fSYnLLUf25DB6yeQK8gcbEl5Ud25N8nQYLIYkMmg 0sw2GdBstdG59IG22SjxMUTWeSJ2mYUdttgAzfAh7r0aO+JOtyv/Bz8sdG8TFRG0Znlk rLXDcLIRfxr+pF1ViE3HbSt1P04xngRjTT6Z1+JqLzlC3U21F72JvVPoaRIKGwsZ1G2c /WDA== 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 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ju5-20020a170903428500b001cc76bea519si6415071plb.87.2023.11.19.11.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 11:50:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; 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 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 7D2198057996; Sun, 19 Nov 2023 11:49:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231814AbjKSTtL (ORCPT + 29 others); Sun, 19 Nov 2023 14:49:11 -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 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 agentk.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 (agentk.vger.email [0.0.0.0]); Sun, 19 Nov 2023 11:49:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783023177175090080 X-GMAIL-MSGID: 1783023177175090080 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: