Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp316500iob; Wed, 18 May 2022 02:53:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsNCHKw40Z8J4Q1uTr2rGHASwPK4RJw+tcwhuW6Bn0QprtaqMDC+wMyQ6KEkdeW68wA986 X-Received: by 2002:a05:6a00:1a86:b0:50f:f4fd:c9a7 with SMTP id e6-20020a056a001a8600b0050ff4fdc9a7mr26655532pfv.46.1652867591476; Wed, 18 May 2022 02:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652867591; cv=none; d=google.com; s=arc-20160816; b=0K3ES48PirgxCLd0qC59a7jjvOL2+n7Pw+dByTzW78vg3MQtmW3CuzyUU0GY+noh7P BE2tvzc7nqJbKhlH7vj3AfhkmDMT4wTdU0DYL1XcW36rqoZBfBH13INpzbILxKpQnxbd wizM0fh5W7sJeGECzZ2zaThXLuhl0JWAK3S+jzVQxRquEzxGkoo+wyfnvyRxLpYmWG81 FQkLJjsoLhdHL7TyLmC9fZXpb22GzlINUEIWXyqaSRoLCFjlqXjE6vpzxGTZ2VdmB7Ye F2oiRa3xYw9aOEJwwtIYoZOGRal4RA6uL5ZdAXI96TXmI0mcrHKr2THaKs65Cx1KLZgj Iv1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=HzOkeYYjSkPEtsKb0hML8fTPGO3mMqRS/q6R7KG3LyM=; b=bYgvLF/0FiX0sTfDeU7LcMsxZUx+pqo4nq4Lb7CEAhzvD/geLH9qkttPeQVHwczMHe Nq1UTLA/N4iT0lgIP92Az1RzQFjePlhMbd7BRUWXwAg+cQS1IHKtP4YwOgtQYS90DLbL gyoHIwa727BoxoRsZ/1xDV0zNx06fucz/UAtZ1Kdd52wnzRrKRIk5fC9iKtigO51976z 4foN7TZArQTtagVb/9xyx8LXU0YI3KUkW2YTxvMGD0ZnCXIwVzrMb6Lsg+1QNpgwd0Mo ywsngFZwuSAozbdEGB9Tl6Gi8qEfcQkoSrj4D3xJ+a1BO5vfADYdgcd50hsBLc0Y6wjQ V2iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Jx7fnVbO; dkim=neutral (no key) header.i=@suse.de header.b=lzNEiCgK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o12-20020a056a00214c00b004fa3a8dffdfsi2257378pfk.150.2022.05.18.02.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 02:53:11 -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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Jx7fnVbO; dkim=neutral (no key) header.i=@suse.de header.b=lzNEiCgK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 322791238BE; Wed, 18 May 2022 02:38:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234521AbiERJiE (ORCPT + 99 others); Wed, 18 May 2022 05:38:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234481AbiERJhx (ORCPT ); Wed, 18 May 2022 05:37:53 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F6A3C8BD4 for ; Wed, 18 May 2022 02:37:50 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C97E121BBE; Wed, 18 May 2022 09:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652866668; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HzOkeYYjSkPEtsKb0hML8fTPGO3mMqRS/q6R7KG3LyM=; b=Jx7fnVbOJ3gO9DN6ryDRbldgEIhfeUCubpkL9E8Ke9vXwuHlKKFWZ0zCa6LQGDlf2vwkjB LSLIOXTpE9vbYpAJiwWiEH0B8obcqAVK+htKlK6oei/RQ3iTJs74+K1Slro6fhbbLV1fjT IkuPvB/3ssIsOAG10J6OpbjNzOCohps= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652866668; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HzOkeYYjSkPEtsKb0hML8fTPGO3mMqRS/q6R7KG3LyM=; b=lzNEiCgKHyOOYmDZHGS7KQd6PbSt0MhgwODN+OrLOko2B5jPkiviP8iEUuG3DMXU8EnQ6W SYgAMdOe/qtQeiBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 93BB9133F5; Wed, 18 May 2022 09:37:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ndHkHGu+hGL1EQAAMHmgww (envelope-from ); Wed, 18 May 2022 09:37:47 +0000 Date: Wed, 18 May 2022 11:37:45 +0200 From: Oscar Salvador To: Miaohe Lin Cc: akpm@linux-foundation.org, willy@infradead.org, vbabka@suse.cz, dhowells@redhat.com, neilb@suse.de, apopple@nvidia.com, david@redhat.com, surenb@google.com, peterx@redhat.com, naoya.horiguchi@nec.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 06/15] mm/swap: remove buggy cache->nr check in refill_swap_slots_cache Message-ID: References: <20220509131416.17553-1-linmiaohe@huawei.com> <20220509131416.17553-7-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509131416.17553-7-linmiaohe@huawei.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 On Mon, May 09, 2022 at 09:14:07PM +0800, Miaohe Lin wrote: > 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 With Andrew's ammendment: Reviewed-by: Oscar Salvador > --- > 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 > > -- Oscar Salvador SUSE Labs