From patchwork Thu Aug 23 11:30:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 10573787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C8C25A4 for ; Thu, 23 Aug 2018 12:29:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 132362BFBC for ; Thu, 23 Aug 2018 12:29:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 072B42BFD6; Thu, 23 Aug 2018 12:29:33 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C0222BFBC for ; Thu, 23 Aug 2018 12:29:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4EE766B21F7; Thu, 23 Aug 2018 08:29:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 49E0B6B295F; Thu, 23 Aug 2018 08:29:31 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38EA26B29E7; Thu, 23 Aug 2018 08:29:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id ECA4A6B21F7 for ; Thu, 23 Aug 2018 08:29:30 -0400 (EDT) Received: by mail-pf1-f198.google.com with SMTP id n17-v6so3108075pff.17 for ; Thu, 23 Aug 2018 05:29:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=nznTzVSExffvEl0n7Bq/TlDEjogLDUOol88me5kk4Do=; b=JZcXL//T3x9klWhgZIe0ALzhz45qwgQ4VuYHOZxJwcKTpJHOFxaDU4JR498S4we4ud 0zOO1x/tEmSEjk2DJCRRB9cNbmjD7hP9VhaDuPyMc5ufu9VYWRz/4sqaACKVtryTWkUA 34eSjgQGIXDFZSK3Lb/F8gKDXxlCl6CTiJ9+mulnGBIzYDv0L5Myp+BjczjhkV5zJDCm FQT4ENnwu8WajsupjAvVwl5mWBd5KDRs+J/HsPLxqPauvZmCoGHDj+b4fXLooESGCSkZ 1qv7/xdATNhwoqBU5M8czHfiTzuLkA3P1LiCTns+uMKfJv5Goi5LTgSnPqNCiJBN7Ky6 fm9A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp X-Gm-Message-State: APzg51AClXstIgiAWpYvYOk3lmm11AFtbRuVaSyKZRePPK1S4oOjJ0TV l28ZAYN7azhCqtAfr9sqJk9hq6VxWAtDvll1pqcEa0j0V5YrVuGtA/vpFo0KSi4FOXV2HZWy4K9 z4K042EfVbbawml2Cqau1B1TmKcHmXwmzGYd8a7gt0OCv+5ZDx8wW5G0MtS2zBBpcaw== X-Received: by 2002:a63:2363:: with SMTP id u35-v6mr3075079pgm.202.1535027370601; Thu, 23 Aug 2018 05:29:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbXV1SOWSNPKNe9EURJumgWwaF7bqLkTkVuUBS0DuL7OkcwEt+7NQIxJCvlWRorYZCUdvR3 X-Received: by 2002:a63:2363:: with SMTP id u35-v6mr3075044pgm.202.1535027369906; Thu, 23 Aug 2018 05:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535027369; cv=none; d=google.com; s=arc-20160816; b=E0Wj+kMspgEqbdQJHlt5suhSryn4FxV7YoY7Pj8sVTzBTDRZmecBz3fyR7Z2rR/hrN pB//RDKUZDpytcPEU5xafIZorBabJft06ALIFGqgKy+keEMh0ElnJXQsgeIh6jxDj/ed gBfA6EgCBHgtuXznc/flZ0BxcTjCfB6X++zw5qETg8dYTqwwS1QGdoNGZe0VTR/MvA7+ SBoPAkhztuu/SBTFZRzqVaoFlh4+JUR9SpOutt+rivp5eCzBTN+wKqPZ3zxY0ilKDmBa dsOqPd28z2j+eZlsN/FFD244kEbnZ0Z0sGdBFNbwwXod159cyHPTqTECqjEMKx+fPfP0 g9Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=nznTzVSExffvEl0n7Bq/TlDEjogLDUOol88me5kk4Do=; b=nmJaXjMWhy2XijnYOm2v/UTz90CKJ0qeZoctPm1iqQQi/AdL6reSngBFp5upXSndMI rOH0s2brpWotEqug/HGzwGHTSB8Uyj4tWM5v5Z7A0rpsJ5Rb3TCrUZ5JaqyPxdvcQa0D FV1+RttXwCJFmhsgKnq55R/ngxMuZc8y5FGJcY8z4Qh0DDpzaiGlXrAIS4MOYN3jDQ9n GeYemRfcwN16Bnus4uMQs1mba3ekJWbRFBtbc5TIvfbGKCQQgm7MYm/zJ50cWEFBv0pn 9Jnh0KebGjGXnXUj3I9Y47CGl8f0AFezKEI2bKr5GgJQMv69PwyEa+Ktf/l4in/EoTE8 SdRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp Received: from www262.sakura.ne.jp (www262.sakura.ne.jp. [202.181.97.72]) by mx.google.com with ESMTPS id p7-v6si4071405plo.159.2018.08.23.05.29.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 05:29:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) client-ip=202.181.97.72; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp Received: from fsav301.sakura.ne.jp (fsav301.sakura.ne.jp [153.120.85.132]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w7NBV2Vd062513; Thu, 23 Aug 2018 20:31:02 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav301.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav301.sakura.ne.jp); Thu, 23 Aug 2018 20:31:02 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav301.sakura.ne.jp) Received: from ccsecurity.localdomain (softbank060157066051.bbtec.net [60.157.66.51]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w7NBUvAa062392 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 23 Aug 2018 20:31:01 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) From: Tetsuo Handa To: Michal Hocko Cc: David Rientjes , Andrew Morton , linux-mm@kvack.org, Tetsuo Handa Subject: [PATCH] mm, oom: Always call tlb_finish_mmu(). Date: Thu, 23 Aug 2018 20:30:48 +0900 Message-Id: <1535023848-5554-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> X-Mailer: git-send-email 1.8.3.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Commit 93065ac753e44438 ("mm, oom: distinguish blockable mode for mmu notifiers") added "continue;" without calling tlb_finish_mmu(). I don't know whether tlb_flush_pending imbalance causes problems other than extra cost, but at least it looks strange. More worrisome part in that patch is that I don't know whether using trylock if blockable == false at entry is really sufficient. For example, since __gnttab_unmap_refs_async() from gnttab_unmap_refs_async() from gnttab_unmap_refs_sync() from __unmap_grant_pages() from unmap_grant_pages() from unmap_if_in_range() from mn_invl_range_start() involves schedule_delayed_work() which could be blocked on memory allocation under OOM situation, wait_for_completion() from gnttab_unmap_refs_sync() might deadlock? I don't know... Signed-off-by: Tetsuo Handa --- mm/oom_kill.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index b5b25e4..4f431c1 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -522,6 +522,7 @@ bool __oom_reap_task_mm(struct mm_struct *mm) tlb_gather_mmu(&tlb, mm, start, end); if (mmu_notifier_invalidate_range_start_nonblock(mm, start, end)) { + tlb_finish_mmu(&tlb, start, end); ret = false; continue; }