Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp744692pxa; Wed, 19 Aug 2020 13:45:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0c7pLq9kQSTuH6CqKQR3dhnXJ9eXrm+qVXzUy1Z2VsODi5ufx2DLi7SuDVlAHKXENxUMl X-Received: by 2002:a17:906:c7d4:: with SMTP id dc20mr101103ejb.283.1597869920057; Wed, 19 Aug 2020 13:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597869920; cv=none; d=google.com; s=arc-20160816; b=lhV+I/gJ+OQMI7DjG1ZNMybiaoFzPT4gMz4YzlNoVz29KPHX9On9GbeOXlGfxgse2a lUcf7cIJbg32ywNsoaKJS9ksWpjZB8tTVAwwJw6jJm5YB0aYxF6tCORSKczaJgVGHice GWeEEsSDDfz72vziZMEra2qKHfuriVJVWWpToZlT2cyfjlYvzqECg+sSgI1ZurNpuiph DAgP792JOaQAS8nFhdr6hiduWdBAMnop5m4YCWDWYHiChR42mtzY+5j45v+Hqm5LfyUs 8LehCMcrXe6y6lCSEVUmyYpszHSdUfJLTw+b1Vz/jNaa93XK2rEUMW3tfZ5mfR9bhA6S cD/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7OkDYQ96IKkBn1skd4NdLteik3rTLwITzQe2j/YDT2U=; b=dwzxtwz8t3x8/JtvQqgSgAO3rInA2PS3CVzoKT9ZY/96gDIdfiOmEJ6DLOeH0Nk2Z+ JRff3HAEfFRqQtrIWB11J3WLYbC+s/6ti2UvNffDTdbIJ8SgvhK+N3huNPYv170aBNlB VmGanBCMDES8xDPGxA8DMC7anfTXBRgSkse34hXXAzl/G9q4Afwl+gaVqq7Z6FswNHpO yFSbtsQEuZ/vIe+z76T0996KmYYfwp7odK+I4ZwoWxfHngeYWuE6QLImX3AcPDxH/E0y bHXUVgbwI8xpwJyzSW6ycreTlkM/s9jyJGjA6+rv2S7s3BUJsiVJ4UmekL9WiAJyat7w JhNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g1TSVA+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si64234edy.92.2020.08.19.13.44.55; Wed, 19 Aug 2020 13:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g1TSVA+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbgHSUoX (ORCPT + 99 others); Wed, 19 Aug 2020 16:44:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33037 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbgHSUoW (ORCPT ); Wed, 19 Aug 2020 16:44:22 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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