From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28138C433E0 for ; Wed, 20 Jan 2021 07:59:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 94F8B23158 for ; Wed, 20 Jan 2021 07:59:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94F8B23158 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B46A86B0006; Wed, 20 Jan 2021 02:59:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF78F6B0007; Wed, 20 Jan 2021 02:59:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E5C96B0008; Wed, 20 Jan 2021 02:59:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id 86BFF6B0006 for ; Wed, 20 Jan 2021 02:59:49 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 42EA31EE6 for ; Wed, 20 Jan 2021 07:59:49 +0000 (UTC) X-FDA: 77725404498.18.list90_2b1740527558 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 22EB5100ED0E0 for ; Wed, 20 Jan 2021 07:59:49 +0000 (UTC) X-HE-Tag: list90_2b1740527558 X-Filterd-Recvd-Size: 2807 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 07:59:48 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1611129587; 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=bqvjZ50v29HmtLhc+2U4jR1bd9+Pi19Rjou3HoGdKRY=; b=hFVv24LAyLfG6vPl6Kx1VUgKwoby0rNYYRkRhxjZNGIpwKV2DlWWf8rCbOc9A7evO/Hf5K k+mmaoZ/KB9jamXK5ubkjsXraYTkYW3iL9DyTk6Pxn0xnEOTU06xOsIK+3i3/gNcE+6Snx zX/Hio0Qv+38wVg/Kbmazy7iezsV6eo= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9FB9DACE1; Wed, 20 Jan 2021 07:59:47 +0000 (UTC) Date: Wed, 20 Jan 2021 08:59:46 +0100 From: Michal Hocko To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Minchan Kim , Joonsoo Kim , Johannes Weiner , Vlastimil Babka , Mel Gorman , Dan Williams , Christoph Hellwig Subject: Re: [PATCH] swap: Check nrexceptional of swap cache before being freed Message-ID: <20210120075946.GD9371@dhcp22.suse.cz> References: <20210120072711.209099-1-ying.huang@intel.com> <20210120074652.GA9371@dhcp22.suse.cz> <87v9bst55v.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87v9bst55v.fsf@yhuang-dev.intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 20-01-21 15:54:04, Huang, Ying wrote: > Michal Hocko writes: > > > On Wed 20-01-21 15:27:11, Huang Ying wrote: > >> To catch the error in updating the swap cache shadow entries or their count. > > > > What is the error? > > There's no error in the current code. But we will change the related > code in the future. So this checking will help us to prevent error in > the future. I will change the patch description to make it more clear. > > > Can it happens in the real life? Why do we need this > > patch? Is crashing the kernel the right way to handle the situation? > > Emm... The mistake to update swap shadow entries will hurt performance, > but will not trigger functionality bug. So it may be better to use > VM_WARN_ON_ONCE(). Yes a warning is much more appropriate approach. The question is whether a test like this is really necessary. But I will leave that to others to decide. It was really the bug on that hit my eyes. -- Michal Hocko SUSE Labs