Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2214179ybz; Sat, 18 Apr 2020 18:40:54 -0700 (PDT) X-Google-Smtp-Source: APiQypLbInBkotCyPj0LdXaK3OFZTL8Bm0fwq8Kh/uLMF5NYRLOKjQ4wNFmxUTrQCMf4DiAlxCMY X-Received: by 2002:aa7:d0d8:: with SMTP id u24mr9291325edo.138.1587260454320; Sat, 18 Apr 2020 18:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587260454; cv=none; d=google.com; s=arc-20160816; b=1H+JtdZ+Qlj7PTfQVaiimHfb3qVMwLEEEn9W/Wh+uKltTC9s877zWZ46UOx2SsFtt2 7RtTkhStayZDVORtN5ZHaaj1p1DUbZ+itQea89k7aRLv/i6PJFcAw7QU19PW7D3Ac+dC pRlNIPPf1XtfkP8BsKzVhZVeerSWPUX3buryUvkS9vAOnTvO3vvfbDkFfX4LWzxcSnR+ LxG4izL2qtKoluePLsx3vJ5VAoOoO+EBlP78Y5vjvb3oLD4WOfTq7zYuw23ZiU2hxn4u 8XyIFP79MYubwfbISBiScZTsY9TaXra+ShtFgWuyJzP40Hls3o92z81SeafrZzKaiDVh 27Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=BQFU3HkYECZtzmLCZGRzFVrW3CLq1ebiJ2ruTF8YJ+o=; b=q9ZbHLZZYxIo5RO0ybBRI5cvSW5rdzviIPWwTrn7mI45WYYxCRVywrJWuv4/G7k75I jS+hsP9DJGP9us5RoVXS5Lpx3QFFm5Vjh4vBiIUqLJBy8VbM7naywKQBlPbkGzdXb01x iTOcbOy27HSLtkmeU8ooUtpS0TMdq6QD46sTdDXDmzQuR68jb3yZka/o2AaemLSr2nWQ 7JY2mj+KVgqNKUdetXZzjMubLaZ2lQxnTFgufmDV+3DlbysdRUPRuaGGwHltRxCcazju anMdniViitjRVfrBTiPwj0QCrKzZct9+NihivuizlJqgbOEWhLTUPXiiBNtZIj8cIiWZ sRBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JWi1xbRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si12707536ejk.464.2020.04.18.18.40.32; Sat, 18 Apr 2020 18:40:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JWi1xbRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726050AbgDSBjf (ORCPT + 99 others); Sat, 18 Apr 2020 21:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725879AbgDSBjd (ORCPT ); Sat, 18 Apr 2020 21:39:33 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 740D4C061A0C for ; Sat, 18 Apr 2020 18:39:33 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id s10so4514974edy.9 for ; Sat, 18 Apr 2020 18:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BQFU3HkYECZtzmLCZGRzFVrW3CLq1ebiJ2ruTF8YJ+o=; b=JWi1xbRpg1gcYErF+rSn53PAiJKAfS7QbtMyFZ4RgGkL7u1vUcNQgkZ378kFXNRilg SdrSiY3vuCQiU+gV7fMtrgOxrT/saiVyvk46pIvPLSRfbC2ERmaiYh7Zj/im+axtnW2g vRPhUjuTseEEKI0RGvYSidchsVXWMNQO4fVBPLkjN3Tps4VrSqeG49kZ8DKWCZcjuk6U jKbOrKephz+itE7eW5fNOtSgP/QzkagitR0YlUaeM3GR+r8mLxN9xydsVvWuphKQXNsI yyWzjhoP/QmXOW05LRIGrM5blgbq0qVqjUk1KAdl4i3TpcKNfPao9KDuRyUSkgAzd938 QbTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BQFU3HkYECZtzmLCZGRzFVrW3CLq1ebiJ2ruTF8YJ+o=; b=RZJ2TL2unK25Oqy6ULzYV/m9hfev0ow3mJ6MDfIx8m/RS+dwMFx8bal2N5mpJqqnxt cepP18TbU7QEdM7zgZN65b3l4vsPAS0Sd/cIM2sNlDlhBJ5FEUf3W94lwAKQj2MYIInH ytm5SkcKddsuAVfzM7XL1nYEUHM98nxpgcNkr0ptYPNeUiG6dQwIHn+chIg4rP7mCr/g Q2NzYCW+yJr9OTZHRWhQ21eTwCvdf3mxB9Jy8YMhigBPGU/KvuZ7ZL+n2Dyz3/0Qdx+D e6/pFQLleZcprX0bbLItzs9BG7WeESYwsRLYXOLQL8ykREuioMgDv/eL3+5k8XkiqhxI AQkQ== X-Gm-Message-State: AGi0PuYwSRnB0Dm8Q4tCB4ZvLFr7kOxAAdc0G6eJONSSbdJcqcWAbrT8 OrUOUPa7Gzc+FCeMougiFD5VkoNK X-Received: by 2002:aa7:d14e:: with SMTP id r14mr9159841edo.200.1587260372227; Sat, 18 Apr 2020 18:39:32 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id r10sm396631edm.55.2020.04.18.18.39.31 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Apr 2020 18:39:31 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, tim.c.chen@linux.intel.com, ying.huang@intel.com, Wei Yang Subject: [PATCH 4/4] mm/swapfile.c: move new_cluster to check free_clusters directly Date: Sun, 19 Apr 2020 01:39:21 +0000 Message-Id: <20200419013921.14390-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200419013921.14390-1-richard.weiyang@gmail.com> References: <20200419013921.14390-1-richard.weiyang@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each time it needs jump to new_cluster, it is sure current percpu_cluster is null. Move the new_cluster to check free_clusters directly. Signed-off-by: Wei Yang --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 07b0bc095411..78e92ff14c79 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -603,9 +603,9 @@ static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, struct swap_cluster_info *ci; unsigned long tmp, max; -new_cluster: cluster = this_cpu_ptr(si->percpu_cluster); if (cluster_is_null(&cluster->index)) { +new_cluster: if (!cluster_list_empty(&si->free_clusters)) { cluster->index = si->free_clusters.head; cluster->next = cluster_next(&cluster->index) * -- 2.23.0