Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbcDYWSW (ORCPT ); Mon, 25 Apr 2016 18:18:22 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:35710 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751267AbcDYWSU (ORCPT ); Mon, 25 Apr 2016 18:18:20 -0400 Date: Mon, 25 Apr 2016 15:18:16 -0700 From: Yu Zhao To: Dan Streetman Cc: Andrew Morton , Seth Jennings , Sergey Senozhatsky , Minchan Kim , Nitin Gupta , Linux-MM , Sergey Senozhatsky , linux-kernel , Dan Streetman Subject: Re: [PATCH] mm/zpool: use workqueue for zpool_destroy Message-ID: <20160425221816.GA1254@google.com> References: <1461619210-10057-1-git-send-email-ddstreet@ieee.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1461619210-10057-1-git-send-email-ddstreet@ieee.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1148 Lines: 25 On Mon, Apr 25, 2016 at 05:20:10PM -0400, Dan Streetman wrote: > Add a work_struct to struct zpool, and change zpool_destroy_pool to > defer calling the pool implementation destroy. > > The zsmalloc pool destroy function, which is one of the zpool > implementations, may sleep during destruction of the pool. However > zswap, which uses zpool, may call zpool_destroy_pool from atomic > context. So we need to defer the call to the zpool implementation > to destroy the pool. > > This is essentially the same as Yu Zhao's proposed patch to zsmalloc, > but moved to zpool. Thanks, Dan. Sergey also mentioned another call path that triggers the same problem (BUG: scheduling while atomic): rcu_process_callbacks() __zswap_pool_release() zswap_pool_destroy() zswap_cpu_comp_destroy() cpu_notifier_register_begin() mutex_lock(&cpu_add_remove_lock); So I was thinking zswap_pool_destroy() might be done in workqueue in zswap.c. This way we fix both call paths. Or you have another patch to fix the second call path?