Received: by 10.192.165.148 with SMTP id m20csp531583imm; Fri, 27 Apr 2018 03:19:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp9BsR4FBHUtQw3d3tzUoqtECIta7rNHXuFjls0UAz/p/Xz5GOrPDRL/A0/svNyYnthEX6/ X-Received: by 10.98.186.26 with SMTP id k26mr1670994pff.195.1524824376544; Fri, 27 Apr 2018 03:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524824376; cv=none; d=google.com; s=arc-20160816; b=RWiw5+y0/59VLBgFNBGmIykYZngHzmPX9EoH8Wpi8x2yHzA4z33xrOiiEBaSoP5P3X WQBn/5VuZuo2wUTqXqH+3mhTiZZnW2UR02eQn4lykBDUpgE44HampMsCkdeLanNdcNzQ xpIR4sd+jUogZYg7hHqB2jdG60YhDUDDsFJgNiVMzefSoGy3EQVIcTk+PD7C5SHvH2vx DSPoHMNAooQQmawrxD4ipHt9r8EN/Wa+i5wHIdsN6dnS58Vm4lRNPNOnSMnvgvMCsI1F Fzb57r2czyC4vYIXwTLi2DR6pelndRPxObrQFpub6y4s98737PRRLzvOX52b75Ioks31 Ymhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:reply-to:from:date :arc-authentication-results; bh=TCNVePNDR8nV94TKRFRRtsPkWMTE0Ze7J5eLt3g5uBg=; b=PO9ZXQhIngYO82dABgrC+SeqJr9ieCw7NxrcdHvp6gx4GkGAdmHRr4cP5DZmd/aPcx yLVDFDk77KGx4mICi3EHkQQEW+ZNA1dF6w44vK6BQdo3Jpk18vMIyemMHzDc1jqjixXj +927mmN9pCV2w4KQYLB/rqHrYu4K+R2mF+F8RvkMznYxua8B3IuDX0BOrzxWQP1nXk91 oWOT5f5Gt1qxuyw88p1HUW+bS2+w2yExq4WV9FCsrqZmuEXkpsLEqSzuQkzqVL+MXn8B SpaArqOXCR1tRAYS+I0zW9n51Kndl4hkUFgGW7ZJvWs5FQNNekngOrGjCLuovslExwhU SRDw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2-v6si963950pgo.289.2018.04.27.03.19.22; Fri, 27 Apr 2018 03:19:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757928AbeD0KRO (ORCPT + 99 others); Fri, 27 Apr 2018 06:17:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757823AbeD0KRN (ORCPT ); Fri, 27 Apr 2018 06:17:13 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F32E430C80B4; Fri, 27 Apr 2018 10:17:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B92C4314EE6A; Fri, 27 Apr 2018 10:17:12 +0000 (UTC) Received: from zmail23.collab.prod.int.phx2.redhat.com (zmail23.collab.prod.int.phx2.redhat.com [10.5.83.28]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9E7D24CA9F; Fri, 27 Apr 2018 10:17:12 +0000 (UTC) Date: Fri, 27 Apr 2018 06:17:12 -0400 (EDT) From: Chunyu Hu Reply-To: Chunyu Hu To: Catalin Marinas Cc: Michal Hocko , Chunyu Hu , Dmitry Vyukov , LKML , Linux-MM Message-ID: <1591480647.20311538.1524824232546.JavaMail.zimbra@redhat.com> In-Reply-To: <20180426125634.uybpbbk5puee7fsg@armageddon.cambridge.arm.com> References: <1524243513-29118-1-git-send-email-chuhu@redhat.com> <20180424132057.GE17484@dhcp22.suse.cz> <850575801.19606468.1524588530119.JavaMail.zimbra@redhat.com> <20180424170239.GP17484@dhcp22.suse.cz> <732114897.20075296.1524745398991.JavaMail.zimbra@redhat.com> <20180426125634.uybpbbk5puee7fsg@armageddon.cambridge.arm.com> Subject: Re: [RFC] mm: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in gfp_kmemleak_mask MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.68.5.41, 10.4.195.5] Thread-Topic: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in gfp_kmemleak_mask Thread-Index: 95TXp4Iul8QzeHq/kZJ7UDe+kvK3Dg== X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 27 Apr 2018 10:17:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Original Message ----- > From: "Catalin Marinas" > To: "Chunyu Hu" > Cc: "Michal Hocko" , "Chunyu Hu" , "Dmitry Vyukov" , > "LKML" , "Linux-MM" > Sent: Thursday, April 26, 2018 8:56:35 PM > Subject: Re: [RFC] mm: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in gfp_kmemleak_mask > > On Thu, Apr 26, 2018 at 08:23:19AM -0400, Chunyu Hu wrote: > > kmemleak is using kmem_cache to record every pointers returned from kernel > > mem > > allocation activities such as kmem_cache_alloc(). every time an object from > > slab allocator is returned, a following new kmemleak object is allocated. > > > > And when a slab object is freed, then the kmemleak object which contains > > the ptr will also be freed. > > > > and kmemleak scan thread will run in period to scan the kernel data, stack, > > and per cpu areas to check that every pointers recorded by kmemleak has at > > least > > one reference in those areas beside the one recorded by kmemleak. If there > > is no place in the memory acreas recording the ptr, then it's possible a > > leak. > > > > so once a kmemleak object allocation failed, it has to disable itself, > > otherwise > > it would lose track of some object pointers, and become less meaningful to > > continue record and scan the kernel memory for the pointers. So disable > > it forever. so this is why kmemleak can't tolerate a slab alloc fail (from > > fault injection) > > > > @Catalin, > > > > Is this right? If something not so correct or precise, please correct me. > > That's a good description, thanks. > > > I'm thinking about, is it possible that make kmemleak don't disable itself > > when fail_page_alloc is enabled? I can't think clearly what would happen > > if several memory allocation missed by kmelkeak trace, what's the bad > > result? > > Take for example a long linked list. If kmemleak doesn't track an object > in such list (because the metadata allocation failed), such list_head is > never scanned and the subsequent objects in the list (pointed at by > 'next') will be reported as leaks. Kmemleak pretty much becomes unusable > with a high number of false positives. Thanks for the example, one object may contain many pointers, so loose one, means many false reports. I'm clear now. > > -- > Catalin > -- Regards, Chunyu Hu