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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 6E7FDC3A59C for ; Fri, 16 Aug 2019 10:02:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42C9D206C2 for ; Fri, 16 Aug 2019 10:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565949779; bh=uAtgwIPqxfU1FWiPvVWQ2/1hMlapE28heyjkbu+Ih8M=; h=Subject:To:Cc:From:Date:List-ID:From; b=I65GS906pKshNy0P5auKM7NysNn3BHPkrsphwZqj3k/K6l1NpPeKIgHD2NuvTTc9P xJYz51L4J57I3dmSHbYgI1CDTPeqSrKeOV5TpKHmuAlnbts1nnC1Kp+y8fLxnG/NRo 6qPKsPLwtqebaGzdchU2STvCKoAs6KK4EQnUNrl4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727021AbfHPKC7 (ORCPT ); Fri, 16 Aug 2019 06:02:59 -0400 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:38955 "EHLO new2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727009AbfHPKC6 (ORCPT ); Fri, 16 Aug 2019 06:02:58 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 92E08176B; Fri, 16 Aug 2019 06:02:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 16 Aug 2019 06:02:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=KfA1fV VELloV9WDvDHJpoYBwcXyUG7woDLfz8sPcR0w=; b=ilKncMDQIlVwZ5etcjiSGq KZu5MBYEUKMy39HlH/eW4/+hk6zx6zb07HzU2xUwDk8e+HCPhzNyshLLsSBr66t1 +olBMVz41/4FwwSenc0zhaza829inkinvMbGnqOvvJBvGt7VSaDOeVwGzqJBbE0l f8dHMNobeGUf2c4Vay/7GP9QHCOkVtfUSaX3J/aURc3pZ4hI3nv7lQAb1wPlUsS1 7+K9WaWo0DZY7pZFPkew4+hrmhseT2mSaaVHbngFPdfbE11hzb8u7usUsCH53PEm 1Hca0Vr9kt0UX0HXd1SYppYbFs3pWPqzicgAO2uSHlxpyI50ktJz3TCrTSSrfURw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeffedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepkeefrdekiedrkeelrd dutdejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomhen ucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 90F8580062; Fri, 16 Aug 2019 06:02:55 -0400 (EDT) Subject: FAILED: patch "[PATCH] mm/z3fold.c: fix z3fold_destroy_pool() ordering" failed to apply to 4.19-stable tree To: henryburns@google.com, akpm@linux-foundation.org, dhowells@redhat.com, henrywolfeburns@gmail.com, jwadams@google.com, shakeelb@google.com, stable@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, viro@zeniv.linux.org.uk, vitaly.vul@sony.com, vitalywool@gmail.com Cc: From: Date: Fri, 16 Aug 2019 12:02:54 +0200 Message-ID: <1565949774144187@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 6051d3bd3b91e96c59e62b8be2dba1cc2b19ee40 Mon Sep 17 00:00:00 2001 From: Henry Burns Date: Tue, 13 Aug 2019 15:37:21 -0700 Subject: [PATCH] mm/z3fold.c: fix z3fold_destroy_pool() ordering The constraint from the zpool use of z3fold_destroy_pool() is there are no outstanding handles to memory (so no active allocations), but it is possible for there to be outstanding work on either of the two wqs in the pool. If there is work queued on pool->compact_workqueue when it is called, z3fold_destroy_pool() will do: z3fold_destroy_pool() destroy_workqueue(pool->release_wq) destroy_workqueue(pool->compact_wq) drain_workqueue(pool->compact_wq) do_compact_page(zhdr) kref_put(&zhdr->refcount) __release_z3fold_page(zhdr, ...) queue_work_on(pool->release_wq, &pool->work) *BOOM* So compact_wq needs to be destroyed before release_wq. Link: http://lkml.kernel.org/r/20190726224810.79660-1-henryburns@google.com Fixes: 5d03a6613957 ("mm/z3fold.c: use kref to prevent page free/compact race") Signed-off-by: Henry Burns Reviewed-by: Shakeel Butt Reviewed-by: Jonathan Adams Cc: Vitaly Vul Cc: Vitaly Wool Cc: David Howells Cc: Thomas Gleixner Cc: Al Viro Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/mm/z3fold.c b/mm/z3fold.c index 1a029a7432ee..43de92f52961 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -818,8 +818,15 @@ static void z3fold_destroy_pool(struct z3fold_pool *pool) { kmem_cache_destroy(pool->c_handle); z3fold_unregister_migration(pool); - destroy_workqueue(pool->release_wq); + + /* + * We need to destroy pool->compact_wq before pool->release_wq, + * as any pending work on pool->compact_wq will call + * queue_work(pool->release_wq, &pool->work). + */ + destroy_workqueue(pool->compact_wq); + destroy_workqueue(pool->release_wq); kfree(pool); }