Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4983291iob; Mon, 9 May 2022 06:17:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEmMdldIf5PguJ3sTpGbR5YOH93NHcj1oVxWu4Jvao+QYl1etSI0uTk8q5WUdMI3QAoeg2 X-Received: by 2002:aa7:88d2:0:b0:50a:cf7d:6ff1 with SMTP id k18-20020aa788d2000000b0050acf7d6ff1mr15982325pff.67.1652102232867; Mon, 09 May 2022 06:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652102232; cv=none; d=google.com; s=arc-20160816; b=F00mUy0BITtC8pXk6L5euZJOo4Umx5ZlTjPhOU5KOV+9zdXw67IWrG92xCQe2o3JcX +uG8iIGq7Rkj9KQtJKZLwZHYv2bhZYPahLR8wwaU9rkCUeFr2KK75kbvzcBAmCBhq0Yq z3Hh2D/iwqt5O8rY1NQ/JIrG7Br2zfwW/lzIEGX+G5bAPXkYT0/qydPEpC23VXWXiQo8 Jwg6QbejgzfCdWZA9gTPPvCyxdC1346lrKwr3aPniokvlZSfZuc3oCnhkpp9JhLkao4A G7E6rz8LNLiMejm/TEKhHLDsh0l3YwZ/Xx2sDZrZlwWZRFswMAIDeJvJrZmUhToy9itK LA3Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nwrq6cEUFUNhQxHyOU4ZDeztKM+4GSwOex84GwT34sY=; b=xwIgOBJQc4t9XxsRZusuXdIVB1JlCW/34razSXhXTwfbmV4LSv06Wrwh/xNg8LVLJP 9JxT6nLmwjnT4iYqy9HsdbO/8WyOudxL/1BifXyS5a5Bmtaydp6SzcB8Fwa+O6g673YP OvpxqRIQp7xsLuGBDSLC68fWgWnWjLdQQPQ3XFto7bzq16dp0lgeyX04FqPJuJmDf3AN h+PijDGP8o8Kx4YQJfU4lQ+z6xRHf0A/TsUaKDoa8w2FwYmqT7E21yx2ncS09g1LTNc3 aVhuMtKv86+Q2R3HKY3vkbUjCiC4Xrt31CprrHY15cL6a3CGHqCEmAoj6cj+h/+RynCe JrEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s21-20020a17090aba1500b001d9a2c30f5bsi18223524pjr.58.2022.05.09.06.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 06:17:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C3DF2A977A; Mon, 9 May 2022 06:15:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235546AbiEINSi (ORCPT + 99 others); Mon, 9 May 2022 09:18:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235283AbiEINSE (ORCPT ); Mon, 9 May 2022 09:18:04 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3A5D2A804F for ; Mon, 9 May 2022 06:14:10 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KxhST0WzczhZ3y; Mon, 9 May 2022 21:13:29 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 9 May 2022 21:14:02 +0800 From: Miaohe Lin To: CC: , , , , , , , , , , , Subject: [PATCH 06/15] mm/swap: remove buggy cache->nr check in refill_swap_slots_cache Date: Mon, 9 May 2022 21:14:07 +0800 Message-ID: <20220509131416.17553-7-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220509131416.17553-1-linmiaohe@huawei.com> References: <20220509131416.17553-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org refill_swap_slots_cache is always called when cache->nr is 0. And if cache->nr != 0, we should return cache->nr instead of 0. So remove such buggy and confusing check. Signed-off-by: Miaohe Lin --- mm/swap_slots.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 2f877e6f87d7..2a65a89b5b4d 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -258,7 +258,7 @@ void enable_swap_slots_cache(void) /* called with swap slot cache's alloc lock held */ static int refill_swap_slots_cache(struct swap_slots_cache *cache) { - if (!use_swap_slot_cache || cache->nr) + if (!use_swap_slot_cache) return 0; cache->cur = 0; -- 2.23.0