Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp315885yba; Wed, 15 May 2019 01:43:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3W64BqnVO5Q6LH8EIccnS4ukormaHcPRgVdsK7m9KQbFWbADsDCiEP8gdQUw2+HzNL2SK X-Received: by 2002:a63:6907:: with SMTP id e7mr448637pgc.209.1557909781951; Wed, 15 May 2019 01:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557909781; cv=none; d=google.com; s=arc-20160816; b=d5HJ8R3TgrVp2XpfC6PV0ZZIyemytmBE+lppMx7nQanxKXs+IlL4Pvw7gMDuCUdNxK d1mtbot1B0fl0GxBHiRiC0+wctqYFDDctEKCj9PLs70nWRQXsui0dvWsGKM5rC2/+Xu8 QbnfKi9x4wlT8MQxjEz9A1peZVStr/YhSYLGkAe8+BPVXHNdiPwGq28uXcjCb8HIhmjn cp2A4dB1jUQLBU7N0Pcc8L01W1GAlJ6TikA8G3CYOvjaZvnanym15OwDXADQjrAuON2T vZYO1hNOyvSRMtvCzumM0/LEyv2L5dUDERMLJWtkojhy9o30e+uUsKtfOHoRfF16CBc+ kDeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=DXKTyv1Zt0cbjxS03oPn1lBJLs878fkqtHSHT6TGUvY=; b=oDfpez9Zly7k+v5fYmCWsYSvqk+Tg3RVrm3Gv36SEwsVA6sT0OWGUkeCCxS0gldK3M /XENC70WbnMrUxRRAMqmQuskFf920ayinghjiUXEgz45LhwPjvhN/YyNws7b0tHxLxH0 A65kALGMzg5LYYyjzhVtBFjNgBMn4li6KWttF6mgWZ9u93EEoUs/pqVogBWZ6K0CZBS7 1iUpdqmoNVW9P0kUhEKuZbshhoinoiobvfoi6mSlZQ1+sfE+C/AWLUb/ifSowJ9fSr92 rp73kcQwFzzAQdcbZ1WXl2Vzk8lJ0ROlqykgj+9/4kyGg9HRJh/EsTeC4OxDZzBIhz6x 0bnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=aNjr5SR1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g191si1332427pgc.197.2019.05.15.01.42.47; Wed, 15 May 2019 01:43:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=aNjr5SR1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726501AbfEOIl1 (ORCPT + 99 others); Wed, 15 May 2019 04:41:27 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:54100 "EHLO forwardcorp1p.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbfEOIlZ (ORCPT ); Wed, 15 May 2019 04:41:25 -0400 Received: from mxbackcorp2j.mail.yandex.net (mxbackcorp2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::119]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 658F52E146D; Wed, 15 May 2019 11:41:22 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [2a02:6b8:0:1a2d::30]) by mxbackcorp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9zoT92Owie-fL0uKV6u; Wed, 15 May 2019 11:41:22 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1557909682; bh=DXKTyv1Zt0cbjxS03oPn1lBJLs878fkqtHSHT6TGUvY=; h=In-Reply-To:Message-ID:References:Date:To:From:Subject:Cc; b=aNjr5SR1VzkHw+xEMkDZjfNamwaILWaRolaTmyWU5+xXDFs9RbvV8LmC1+fXO4YCP dm2PkDwHYBgEKcdaXOl1syN8qZ/el2BXO6s9Bno/cJUjP8agzdxS8NqjpxZqkvdF5P GFMlg9fUgmB31B3VVcLdRfMkfsf1X2zY9luH43kk= Authentication-Results: mxbackcorp2j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:ed19:3833:7ce1:2324]) by smtpcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id wNdlQeZj5Y-fLl0uD8T; Wed, 15 May 2019 11:41:21 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Subject: [PATCH 4/5] proc: use down_read_killable for /proc/pid/clear_refs From: Konstantin Khlebnikov To: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org Cc: Cyrill Gorcunov , Kirill Tkhai , Al Viro Date: Wed, 15 May 2019 11:41:21 +0300 Message-ID: <155790968147.1319.10247444846354273332.stgit@buzz> In-Reply-To: <155790967258.1319.11531787078240675602.stgit@buzz> References: <155790967258.1319.11531787078240675602.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace the only unkillable mmap_sem lock in clear_refs_write. Signed-off-by: Konstantin Khlebnikov --- fs/proc/task_mmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 78bed6adc62d..7f84d1477b5b 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1140,7 +1140,10 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, goto out_mm; } - down_read(&mm->mmap_sem); + if (down_read_killable(&mm->mmap_sem)) { + count = -EINTR; + goto out_mm; + } tlb_gather_mmu(&tlb, mm, 0, -1); if (type == CLEAR_REFS_SOFT_DIRTY) { for (vma = mm->mmap; vma; vma = vma->vm_next) {