From patchwork Thu Mar 2 15:45:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 9600645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84D9F60429 for ; Thu, 2 Mar 2017 15:52:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71AE427FB1 for ; Thu, 2 Mar 2017 15:52:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 637202654B; Thu, 2 Mar 2017 15:52:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8A792654B for ; Thu, 2 Mar 2017 15:52:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753983AbdCBPs1 (ORCPT ); Thu, 2 Mar 2017 10:48:27 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36530 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753053AbdCBPqj (ORCPT ); Thu, 2 Mar 2017 10:46:39 -0500 Received: by mail-wr0-f195.google.com with SMTP id l37so9992926wrc.3; Thu, 02 Mar 2017 07:45:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IO0hYxEIisL0GW67+xESHWRpeYVoUqTNoDPvBey2YNA=; b=p9q/N/WehjPmcDA6XvK3Fz2FRxARjeJ1ivSljLeNd6cSHW/IHAFXp20pa9GqF0+khQ sh/tweHmBAny5Sv329eQgK0sHemuuB9hNDyKW2sUiwrEUdqpzKy8CY3I/UQgGuwvO1Yz Z0Sq+SUXXwZSTvr9Web74WOd5yMbqHoIN5UYWlO+7JYn4djSWdkVjk2rJhrF9TTXEGrz sfjqU4jg7ndYRy7me3A6UlNdrq+mtTCcG/8pJPcZrqEHzhXZhDoUx+lcOkDcLcAbgJ5L zsSAUx/GwYsNaaJYNhQ6nghREZS4d8soFe/DyOKRP0w3QiLITrSlkQ9cSqpfaVAI26C3 tC4A== X-Gm-Message-State: AMke39lEraosPlD/Np4Rb6AM4peHxLcySsvDZW1bo+QwqQDU0iGubNXn+sPQpsINOgxBZw== X-Received: by 10.223.176.217 with SMTP id j25mr14014507wra.8.1488469551979; Thu, 02 Mar 2017 07:45:51 -0800 (PST) Received: from tiehlicka.suse.cz (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id 10sm27598907wmi.23.2017.03.02.07.45.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 07:45:51 -0800 (PST) From: Michal Hocko To: Christoph Hellwig , Brian Foster Cc: Tetsuo Handa , Xiong Zhou , linux-xfs@vger.kernel.org, , LKML , , Michal Hocko Subject: [PATCH 2/2] xfs: back off from kmem_zalloc_greedy if the task is killed Date: Thu, 2 Mar 2017 16:45:41 +0100 Message-Id: <20170302154541.16155-2-mhocko@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302154541.16155-1-mhocko@kernel.org> References: <20170302153002.GG3213@bfoster.bfoster> <20170302154541.16155-1-mhocko@kernel.org> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michal Hocko It doesn't really make much sense to retry vmalloc request if the current task is killed. We should rather bail out as soon as possible and let it RIP as soon as possible. The current implementation of vmalloc will fail anyway. Suggested-by: Brian Foster Signed-off-by: Michal Hocko Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster --- fs/xfs/kmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c index ee95f5c6db45..01c52567a4ff 100644 --- a/fs/xfs/kmem.c +++ b/fs/xfs/kmem.c @@ -34,7 +34,7 @@ kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize) size_t kmsize = maxsize; while (!(ptr = vzalloc(kmsize))) { - if (kmsize == minsize) + if (kmsize == minsize || fatal_signal_pending(current)) break; if ((kmsize >>= 1) <= minsize) kmsize = minsize;