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=-3.8 required=3.0 tests=BAYES_00, 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 77C1BC433DB for ; Fri, 22 Jan 2021 00:02:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D7B3023381 for ; Fri, 22 Jan 2021 00:02:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7B3023381 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 548996B0006; Thu, 21 Jan 2021 19:02:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F96F6B0007; Thu, 21 Jan 2021 19:02:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40FF56B0008; Thu, 21 Jan 2021 19:02:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0105.hostedemail.com [216.40.44.105]) by kanga.kvack.org (Postfix) with ESMTP id 2C0246B0006 for ; Thu, 21 Jan 2021 19:02:12 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E8483181AF5E6 for ; Fri, 22 Jan 2021 00:02:11 +0000 (UTC) X-FDA: 77731458462.13.knife92_2c161a027567 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id D404B18140B69 for ; Fri, 22 Jan 2021 00:02:11 +0000 (UTC) X-HE-Tag: knife92_2c161a027567 X-Filterd-Recvd-Size: 2725 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 00:02:10 +0000 (UTC) IronPort-SDR: hghAORDC8wfBzcykYdLpnj3LRKXhahcJmbodFhLChhm0z++7SmcM39CG9GwZQUnAjq16Dc1Al5 fQwbN3IkpobQ== X-IronPort-AV: E=McAfee;i="6000,8403,9871"; a="158545999" X-IronPort-AV: E=Sophos;i="5.79,365,1602572400"; d="scan'208";a="158545999" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2021 16:02:03 -0800 IronPort-SDR: KCvw4PqwOBIcWa30wlCRaTqttJD7zB98M0tE180MBEv2A3k0NzMy965qQhuVoIjcB35cf17saJ jrOaM++QqVhA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,365,1602572400"; d="scan'208";a="356707657" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.145]) by fmsmga008.fm.intel.com with ESMTP; 21 Jan 2021 16:02:01 -0800 From: "Huang\, Ying" To: Matthew Wilcox Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Minchan Kim , Joonsoo Kim , Johannes Weiner , Vlastimil Babka , Mel Gorman , Michal Hocko , Dan Williams , Christoph Hellwig Subject: Re: [PATCH] swap: Check nrexceptional of swap cache before being freed References: <20210120072711.209099-1-ying.huang@intel.com> <20210121184456.GB4127393@casper.infradead.org> Date: Fri, 22 Jan 2021 08:02:00 +0800 In-Reply-To: <20210121184456.GB4127393@casper.infradead.org> (Matthew Wilcox's message of "Thu, 21 Jan 2021 18:44:56 +0000") Message-ID: <87pn1xsutj.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii 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: Matthew Wilcox writes: > On Wed, Jan 20, 2021 at 03:27:11PM +0800, Huang Ying wrote: >> To catch the error in updating the swap cache shadow entries or their count. > > I just resent a patch that removes nrexceptional tracking. > > Can you use !mapping_empty() instead? Sure. Will use that in the next version. Best Regards, Huang, Ying >> void exit_swap_address_space(unsigned int type) >> { >> - kvfree(swapper_spaces[type]); >> + int i; >> + struct address_space *spaces = swapper_spaces[type]; >> + >> + for (i = 0; i < nr_swapper_spaces[type]; i++) >> + VM_BUG_ON(spaces[i].nrexceptional); >> + kvfree(spaces); >> nr_swapper_spaces[type] = 0; >> swapper_spaces[type] = NULL; >> } >> -- >> 2.29.2 >> >>