Received: by 10.223.176.46 with SMTP id f43csp416971wra; Tue, 23 Jan 2018 23:47:31 -0800 (PST) X-Google-Smtp-Source: AH8x224LT0U7Pmp4EmNuZ5qUJQuVwG5ls18wfZdyOgh+cIYErHQMgHfYQw0/gskfoPuWm3dUpxjT X-Received: by 10.101.81.7 with SMTP id f7mr10191248pgq.423.1516780051595; Tue, 23 Jan 2018 23:47:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516780051; cv=none; d=google.com; s=arc-20160816; b=rtZ9XNtu1eAPbCDEyu83f+TbWc8ZDcovoxl1s/r0rMe2CrIp0AG+Q7GfJjIPTRuJPO RrT0t2qVY89KT7PwKa8HWaiYu+oge/gTURBtAggL7OuZDBqwChLyq5+iIfTvH5YX2J5F zXO6ShwWwmJ6b+APNCGRn4W1DdIMiR7G903aIoxhNSvzunHuEhtruCZXWtXZ6fXdHLeE +k8qAYiS6rW3eqZXe7O52zLpj/3g73WRMKb3PAUXFVkFB2FDE79hHhaGQzoRkGenONzw FweDhUcxCKwqLpmrPRSKPw+8O+kyg5GpgzT2fe8v6pYhv9AgAnXc7kDixNYgOef4zvm1 0NDw== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=G/i6Qw6zvzpB47q7OuZ9XXZHyFCQnJI3vnWl5SUwKJo=; b=PNz2qNdzBAW/f7J2eDT6Nc/vFtycZiOnbYt5dvUj2a+4RZVuSdhFdM8WZaVLunGrw/ /7V6Fmk+oAMqKq5x26Rs3Pb0BxM8sso8c6iOXEvmaHafEYF5uWZi4rbnEFtNrO/ru4lW T1CQW2ySs6SQfzztuglci5bVhqHaIwOz3iUKvs7CpBNf8kdSgPkxtJLBP76JUG/j+Jqo /l1bDml3TTEUn0hu+In1aGPe5+04vb0T/ClXpThuqN8GX1GK2OrE/OkWfjy9+/6EtNRF Hx88iV1RjxQ7ScOtZRNmKW8hvQd7//dtDn5Lv+q8CswPAY9FgKyN5rK6tDfwmxyF23Bw qTuw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3si804460pgs.103.2018.01.23.23.47.16; Tue, 23 Jan 2018 23:47:31 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752537AbeAXHqt (ORCPT + 99 others); Wed, 24 Jan 2018 02:46:49 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:37885 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751399AbeAXHqr (ORCPT ); Wed, 24 Jan 2018 02:46:47 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 256B114DF700E; Wed, 24 Jan 2018 15:46:33 +0800 (CST) Received: from [127.0.0.1] (10.177.29.40) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.361.1; Wed, 24 Jan 2018 15:46:29 +0800 Subject: Re: [PATCH AUTOSEL for 4.14 078/100] kmemleak: add scheduling point to kmemleak_scan() To: Sasha Levin , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" References: <20180124041414.32065-1-alexander.levin@microsoft.com> <20180124041414.32065-78-alexander.levin@microsoft.com> CC: Michal Hocko , Andrew Morton , Linus Torvalds From: Yisheng Xie Message-ID: Date: Wed, 24 Jan 2018 15:46:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20180124041414.32065-78-alexander.levin@microsoft.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.40] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sasha, There is a fix patch for this patch: 13ab183 mm/kmemleak.c: make cond_resched() rate-limiting more efficient So if this patch is backported to stable, maybe the above patch is also need to be backported too. Thanks Yisheng On 2018/1/24 12:15, Sasha Levin wrote: > From: Yisheng Xie > > [ Upstream commit bde5f6bc68db51128f875a756e9082a6c6ff7b4c ] > > kmemleak_scan() will scan struct page for each node and it can be really > large and resulting in a soft lockup. We have seen a soft lockup when > do scan while compile kernel: > > watchdog: BUG: soft lockup - CPU#53 stuck for 22s! [bash:10287] > [...] > Call Trace: > kmemleak_scan+0x21a/0x4c0 > kmemleak_write+0x312/0x350 > full_proxy_write+0x5a/0xa0 > __vfs_write+0x33/0x150 > vfs_write+0xad/0x1a0 > SyS_write+0x52/0xc0 > do_syscall_64+0x61/0x1a0 > entry_SYSCALL64_slow_path+0x25/0x25 > > Fix this by adding cond_resched every MAX_SCAN_SIZE. > > Link: http://lkml.kernel.org/r/1511439788-20099-1-git-send-email-xieyisheng1@huawei.com > Signed-off-by: Yisheng Xie > Suggested-by: Catalin Marinas > Acked-by: Catalin Marinas > Cc: Michal Hocko > Signed-off-by: Andrew Morton > Signed-off-by: Linus Torvalds > Signed-off-by: Sasha Levin > --- > mm/kmemleak.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/kmemleak.c b/mm/kmemleak.c > index 7780cd83a495..a1ba553816eb 100644 > --- a/mm/kmemleak.c > +++ b/mm/kmemleak.c > @@ -1532,6 +1532,8 @@ static void kmemleak_scan(void) > if (page_count(page) == 0) > continue; > scan_block(page, page + 1, NULL); > + if (!(pfn % (MAX_SCAN_SIZE / sizeof(*page)))) > + cond_resched(); > } > } > put_online_mems(); >