Received: by 10.192.165.148 with SMTP id m20csp4905731imm; Tue, 24 Apr 2018 10:17:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/qXNZL19sE0as24UYf+h67mtU/aac66zbIh8rXArUgmhN7DGCST0/RkUH4kEILrgkoeBEx X-Received: by 10.99.101.66 with SMTP id z63mr21025250pgb.383.1524590262790; Tue, 24 Apr 2018 10:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524590262; cv=none; d=google.com; s=arc-20160816; b=eUBXzguo/kV/Tq9p1blHNF4NEOXY32zwIyu+LaR1fg6bB+FX5lDWawNRU1vAM6WZCd 3cxQHpUTflRLqrKghcikiKQJtsGQjYIircyWkfjBwsImLuDoGwEOprBp3L9yLHboxd6x 9VLrXbMmrKpfn6+FsNoCTcwNFwhrz9q8TjzGI7vkV2q3yg4rkvGBySFFn/HDkKL5GyRf MGuyUtMzZWK2ZoOJA9r+BpzQZ2MMv/zISfKVmePyJYHR7sv37Q+sslj+w1vv42oJ8CRj opM31401bOSythLsNdhY3YwtX5tNC0BnmEmk3G9psBsqEHwJTH40ZM1q2ktqF6K2VlDe /2qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=DC4rd5gfAAGR6mnoPkiJmSGWOi3mKdFT3zIrRGvre4U=; b=KqN4HS0GzpGUnz5n9xDqSNghsuT+rdAnVbxt0AFd/U3Rv1UJR2hEip6rBVQISnEpqk 1W/l5YISrMIrQdkyen3v9U9JRhjvEFeV/w6xrRz3MhT0MAFRteAih5nrMuwyOt59Wl9/ 8uuZCO6gjFgT8FIzAdrInzRJx7q3UTMkiiWgZojZh3dFiD1kJSYtoyeWtN5Q+90RsFr/ Maz38cm2K79yVZoJBq+n0cw5J1LFzFvcvlardxaUtG4TLfOq5ybjobwhs+7+tjOhoPtb iW+IL/8PMcXqynAyaQquVw6ZIxlQhsLYIbWZsq2CjxZkGd6J9aeY2jmQ1CBuU5a8wDOB OP2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cA4/J9Z+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b126si12057867pgc.579.2018.04.24.10.17.28; Tue, 24 Apr 2018 10:17:42 -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=@google.com header.s=20161025 header.b=cA4/J9Z+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751229AbeDXRQW (ORCPT + 99 others); Tue, 24 Apr 2018 13:16:22 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33019 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757AbeDXRQV (ORCPT ); Tue, 24 Apr 2018 13:16:21 -0400 Received: by mail-pg0-f67.google.com with SMTP id i194so11336456pgd.0 for ; Tue, 24 Apr 2018 10:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=DC4rd5gfAAGR6mnoPkiJmSGWOi3mKdFT3zIrRGvre4U=; b=cA4/J9Z+yOJBbHl3MpQmMCnz/jOayzty+W1u9MpW9pQJsf+q6aYO6PAMU8mK5ihr1d mWEhQ0MIaIydDJNzT/XLs23XWKNlHaMpqby2KYEYWpVfQ9KeS7wsA3eMWMGtBuPdPRNl rH2wgv2Cj+jcq/zz4ai0NNf/TqRWHvtmr/29KJ994Wi115ue2CjOr8ELSGBBMs+NYo4d iP/GlSyoVwH79iRnhrW2r73Ay2nS0q32HE7YNCFHf5PORE6TP0XMM5jdNioK0oSHI34N PDJaycF0jpw26BzjvrOfEYbg7JysC++zUimLtx9TP6sbLD/huClDH1AZPqI7xar9E7Kz c1rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DC4rd5gfAAGR6mnoPkiJmSGWOi3mKdFT3zIrRGvre4U=; b=AK1nkGEUNbosvmu7GGs7aK+E9NweUxdHUvi8DysRzLdnkcwzWt6JH+8QEI5GyM4t90 XYmnLKudFSKmdfX7AKBqWUHob9dycIkTDdXIsGQRNI1ZqoF/8iraAHpm9srdmlKa7v/V 6kV+pIRnwQtbg4gGdB2omiZy5KwpRP/3Yy93f6wII5iyR30kt1eYv63tqnXq4xpG6q73 Lu/SijOKrQCdhDihOhsvHhtB2bHq6jJWarEwckRBOI4RZgG4INGssguLq3V0nog7sNFD JKKoLmfEE34nEYR7R3jtw+nW/mDeODP2O+izTiAcEgX3tjzt4MNb4IbFYwj2lnVDT0W9 fVrw== X-Gm-Message-State: ALQs6tBbFBjctuLZEmjJ6mGeoPIq4kdryLavORzrnxmZmxTzEEbstmJO 5QEhi6emO8QbBRMvkVSMeFoaknFQdXi/44dSy4GOyA== X-Received: by 10.167.131.146 with SMTP id u18mr24743236pfm.199.1524590180932; Tue, 24 Apr 2018 10:16:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.147.130 with HTTP; Tue, 24 Apr 2018 10:16:00 -0700 (PDT) In-Reply-To: <20180424170239.GP17484@dhcp22.suse.cz> References: <1524243513-29118-1-git-send-email-chuhu@redhat.com> <20180420175023.3c4okuayrcul2bom@armageddon.cambridge.arm.com> <20180422125141.GF17484@dhcp22.suse.cz> <20180424132057.GE17484@dhcp22.suse.cz> <850575801.19606468.1524588530119.JavaMail.zimbra@redhat.com> <20180424170239.GP17484@dhcp22.suse.cz> From: Dmitry Vyukov Date: Tue, 24 Apr 2018 19:16:00 +0200 Message-ID: Subject: Re: [RFC] mm: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in gfp_kmemleak_mask To: Michal Hocko Cc: Chunyu Hu , Chunyu Hu , Catalin Marinas , LKML , Linux-MM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 24, 2018 at 7:02 PM, Michal Hocko wrote: > On Tue 24-04-18 12:48:50, Chunyu Hu wrote: >> >> >> ----- Original Message ----- >> > From: "Michal Hocko" >> > To: "Chunyu Hu" >> > Cc: "Dmitry Vyukov" , "Catalin Marinas" , "Chunyu Hu" >> > , "LKML" , "Linux-MM" >> > Sent: Tuesday, April 24, 2018 9:20:57 PM >> > Subject: Re: [RFC] mm: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in gfp_kmemleak_mask >> > >> > On Mon 23-04-18 12:17:32, Chunyu Hu wrote: >> > [...] >> > > So if there is a new flag, it would be the 25th bits. >> > >> > No new flags please. Can you simply store a simple bool into fail_page_alloc >> > and have save/restore api for that? >> >> Hi Michal, >> >> I still don't get your point. The original NOFAIL added in kmemleak was >> for skipping fault injection in page/slab allocation for kmemleak object, >> since kmemleak will disable itself until next reboot, whenever it hit an >> allocation failure, in that case, it will lose effect to check kmemleak >> in errer path rose by fault injection. But NOFAULT's effect is more than >> skipping fault injection, it's also for hard allocation. So a dedicated flag >> for skipping fault injection in specified slab/page allocation was mentioned. > > I am not familiar with the kmemleak all that much, but fiddling with the > gfp_mask is a wrong way to achieve kmemleak specific action. I might be I would say this is more like slab fault injection-specific action. It can be used in other debugging facilities. Slab fault injection is a part of slab. Slab behavior is generally controlled with gfp_mask. > easilly wrong but I do not see any code that would restore the original > gfp_mask down the kmem_cache_alloc path. > >> d9570ee3bd1d ("kmemleak: allow to coexist with fault injection") >> >> Do you mean something like below, with the save/store api? But looks like >> to make it possible to skip a specified allocation, not global disabling, >> a bool is not enough, and a gfp_flag is also needed. Maybe I missed something? > > Yes, this is essentially what I meant. It is still a global thing which > is not all that great and if it matters then you can make it per > task_struct. That really depends on the code flow here. If we go this route, it definitely needs to be per task and also needs to work with interrupts: switch on interrupts and not corrupt on interrupts. A gfp flag is free of these problems.