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.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 7DB1EC433DF for ; Wed, 19 Aug 2020 20:44:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 337A6207DE for ; Wed, 19 Aug 2020 20:44:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="g1TSVA+C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 337A6207DE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9E2408D0058; Wed, 19 Aug 2020 16:44:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9955C8D0057; Wed, 19 Aug 2020 16:44:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A8A58D0058; Wed, 19 Aug 2020 16:44:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 72C748D0057 for ; Wed, 19 Aug 2020 16:44:23 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3B286181AEF07 for ; Wed, 19 Aug 2020 20:44:23 +0000 (UTC) X-FDA: 77168496006.19.voice29_2a0c9c92702a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 03C051AD1B0 for ; Wed, 19 Aug 2020 20:44:22 +0000 (UTC) X-HE-Tag: voice29_2a0c9c92702a X-Filterd-Recvd-Size: 3778 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Aug 2020 20:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597869861; h=from:from:reply-to:subject:subject: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=7OkDYQ96IKkBn1skd4NdLteik3rTLwITzQe2j/YDT2U=; b=g1TSVA+CK1/b2E/E63GHG31u92GF1YVCThiZeuNViYGU0nRZwAitoyCY17Pw0ITOz5N6o5 n6CYKuij+GTFW/tTmnfojI1iJipq7W+RFzA7IPC20rDNB8vLcqVta8fwiKatgwllBNzadm 5T8TrRglcLF+5QPSzuchvXw0sFNxATg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-HXE_-mByMEmpw9K4m0mpYQ-1; Wed, 19 Aug 2020 16:44:17 -0400 X-MC-Unique: HXE_-mByMEmpw9K4m0mpYQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67D91425E1; Wed, 19 Aug 2020 20:44:16 +0000 (UTC) Received: from optiplex-lnx (unknown [10.3.128.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA7AB747B0; Wed, 19 Aug 2020 20:44:08 +0000 (UTC) Date: Wed, 19 Aug 2020 16:44:05 -0400 From: Rafael Aquini To: Andrew Morton Cc: Gao Xiang , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Carlos Maiolino , Eric Sandeen , "Huang, Ying" , stable Subject: Re: [PATCH] mm, THP, swap: fix allocating cluster for swapfile by mistake Message-ID: <20200819204405.GB2096425@optiplex-lnx> References: <20200819195613.24269-1-hsiangkao@redhat.com> <20200819130506.eea076dd618644cd7ff875b6@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819130506.eea076dd618644cd7ff875b6@linux-foundation.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Rspamd-Queue-Id: 03C051AD1B0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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, Aug 19, 2020 at 01:05:06PM -0700, Andrew Morton wrote: > On Thu, 20 Aug 2020 03:56:13 +0800 Gao Xiang wrote: > > > SWP_FS doesn't mean the device is file-backed swap device, > > which just means each writeback request should go through fs > > by DIO. Or it'll just use extents added by .swap_activate(), > > but it also works as file-backed swap device. > > This is very hard to understand :( > I'll work with Gao to rephrase that message. Sorry! > > So in order to achieve the goal of the original patch, > > SWP_BLKDEV should be used instead. > > > > FS corruption can be observed with SSD device + XFS + > > fragmented swapfile due to CONFIG_THP_SWAP=y. > > > > Fixes: f0eea189e8e9 ("mm, THP, swap: Don't allocate huge cluster for file backed swap device") > > Fixes: 38d8b4e6bdc8 ("mm, THP, swap: delay splitting THP during swap out") > > Why do you think it has taken three years to discover this? > My bet here is that it's rare to go for a swapfile on non-rotational devices, and even rarer to create the swapfile when the filesystem is already fragmented. RHEL-8, v4.18-based, is starting to see more adpters among Red Hat's customer base, thus the report now. We are also working on a secondary issue related to CONFIG_THP_SWAP, as well, where the deferred THP split registered shriker goes for a NULL pointer dereference in case the swap device is backed by a rotational drive. -- Rafael