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 BDA9AC41514 for ; Fri, 16 Aug 2019 10:03:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92B5C2133F for ; Fri, 16 Aug 2019 10:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565949787; bh=IXh3OEC3H1PhUvWTXxleARpuxigUVAVqm6b9yu4DhXE=; h=Subject:To:Cc:From:Date:List-ID:From; b=ivNQhOkEhhczk8g4Rh49kO2q17nhz+VTlKSkxaYJ2P3Wn1ZlFKSFnxdCzsBWqEURr fxb45PPPKn4GxgbZW6XChwhlElECHjiAlPN6kqg8wkQlsNGSVULofJGyBE18IMtaiw xmoPUg2VjqrRrxcnc2U6JgY88JesTFIVwhlBTmb8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726993AbfHPKDH (ORCPT ); Fri, 16 Aug 2019 06:03:07 -0400 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:49565 "EHLO new2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726839AbfHPKDH (ORCPT ); Fri, 16 Aug 2019 06:03:07 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id E5A511DEE; Fri, 16 Aug 2019 06:03:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 16 Aug 2019 06:03:05 -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=azNnRp SxqrNEaH6ORXZNNcBUClDXFYqitlnSRrHUKvw=; b=PKIPjW8i/TOu0TYkaZac2G VL7DXdEJssbf/vzZorx3/j63y4kYyEUcL+LC5OCEIwt/8FcTBuyeHYMHppDDACXL Ri6ImQwNGbUosAHnDeHgBqZlg5XICeoMO/3nwnAK40Wuj8kO7g5KHH8m0zwMrx/l ijPi/HqzjaK0GP9dRlcrSKoa6zuagPxaGCx2xYF3As9vkmpzgTZBjb1JJZizp8yU UqHdc0HJhq5W2TnBDG48f0hWybsqqcGH8aDytoH6DErnV8NV/T4usv5B9H4nYAAC akY7ph+GF/HtBMsPm4iIyxU6cnEYYaJiODZ5SLfjxjBjKr69dsLdQzmW/MzFp+Ug == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeffedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepkeefrdekiedrkeelrd dutdejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomhen ucevlhhushhtvghrufhiiigvpedu 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 66044380089; Fri, 16 Aug 2019 06:03:05 -0400 (EDT) Subject: FAILED: patch "[PATCH] mm/z3fold.c: fix z3fold_destroy_pool() ordering" failed to apply to 4.14-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:55 +0200 Message-ID: <1565949775162114@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.14-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); }