Received: by 10.192.165.148 with SMTP id m20csp4878236imm; Tue, 24 Apr 2018 09:50:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+X2pjo5Mk6nIeGqluE0r5NnNouC3uCp+7uMW09RsxKYPWQ99ig8BWjlZ0SC1E7Tsi97L3d X-Received: by 2002:a17:902:57d8:: with SMTP id g24-v6mr25993662plj.337.1524588617123; Tue, 24 Apr 2018 09:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524588617; cv=none; d=google.com; s=arc-20160816; b=mEaTsNrc3aNT8znuW+n8zRsc92JfCv2a67AwgoxfbMIhR4QjbQyoyggUp1pVNIhDGl K2prh2iHvud2EcZYkqHyTI8Wfa3wFdlcKQ6zdfwat23+WhD33JCArSUVe+qaY9QV1zGB fTUlyYlZljLAuvuz/43pKoCor90HLQRIfJFkvjQRBEOk245/bDDCxjvfA3kAJ5t6JQCM +ACpseOpCgVdlZM/Sqe70ilOqQ3pbJy+pf3nEyvqg3O01+O3vVHtwyn8Z5yEs9EzRQSr 4mKGJs9/n1r1iMBsrq964a1GAYWEakAd+uC2AwxORfUVbdmZ8klNLAk4Viy0rlyVQ6Ev NJDQ== 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=vBeqfkyTcizbdkLPEQv1ux0/DuhIz0+0673kzpH0aas=; b=zo+TApY8brEEz1220a/BGqQo52Zpxm1q7AJr+60tJemC9ei+XdG7IVL6VqYP5lLbCT LHxntnbIpuL6gc9MmaadjAEOCJCZUoPx9uCEe8Xb/V8TT6PPaAKeVbNn1xx0oXWMaG/S JsyPzhKWW8z9zQcOaHHA1/L1Dk1ryUnnsiZH+qHKXtKlnOCt8EOEHMdg4QUG8WAbGiRB eQjFRYW9kz73oodiTZlYzXs/IdB+f/DmX6fGyvSXQYQqUi5uD8Hny+/1Jd9pxUEz5VQN 3EEuBKGao213/kFHMrUiWPbaPDTiWbq9v//dJUf54XQ0VVANWKLTaOwe8W96GuvcbIJ8 u4Bw== 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 a10si9791778pfk.350.2018.04.24.09.50.02; Tue, 24 Apr 2018 09:50:17 -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 S1751994AbeDXQsx (ORCPT + 99 others); Tue, 24 Apr 2018 12:48:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11856 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbeDXQsv (ORCPT ); Tue, 24 Apr 2018 12:48:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC05C84C9; Tue, 24 Apr 2018 16:48:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A0DCB51DFB; Tue, 24 Apr 2018 16:48:51 +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 515AC180BAD6; Tue, 24 Apr 2018 16:48:50 +0000 (UTC) Date: Tue, 24 Apr 2018 12:48:50 -0400 (EDT) From: Chunyu Hu Reply-To: Chunyu Hu To: Michal Hocko Cc: Chunyu Hu , Dmitry Vyukov , Catalin Marinas , LKML , Linux-MM Message-ID: <850575801.19606468.1524588530119.JavaMail.zimbra@redhat.com> In-Reply-To: <20180424132057.GE17484@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> 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.20, 10.4.195.24] Thread-Topic: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in gfp_kmemleak_mask Thread-Index: /ptDTdZyFm9byUxQdjPK1jDcg19Oag== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 24 Apr 2018 16:48:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- 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. 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? diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 905db9d..ca6f609 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3053,14 +3053,28 @@ struct page *rmqueue(struct zone *preferred_zone, bool ignore_gfp_highmem; bool ignore_gfp_reclaim; + bool ignore_kmemleak_fault; u32 min_order; } fail_page_alloc = { .attr = FAULT_ATTR_INITIALIZER, .ignore_gfp_reclaim = true, .ignore_gfp_highmem = true, + .ignore_kmemleak_fault = true, .min_order = 1, }; +bool saved_fail_page_alloc_ignore; +void fail_page_alloc_ignore_save(void) +{ + saved_fail_page_alloc_ignore = fail_page_alloc.ignore_kmemleak_fault; + fail_page_alloc.ignore_kmemleak_fault = true; +} + +void fail_page_alloc_ignore_restore(void) +{ + fail_page_alloc.ignore_kmemleak_fault = saved_fail_page_alloc_ignore; +} + static int __init setup_fail_page_alloc(char *str) { return setup_fault_attr(&fail_page_alloc.attr, str); @@ -3075,6 +3089,9 @@ static bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) return false; if (fail_page_alloc.ignore_gfp_highmem && (gfp_mask & __GFP_HIGHMEM)) return false; + /* looks like here we still need a new GFP_KMEMLKEAK flag ... */ + if (fail_page_alloc.ignore_kmemleak_fault && (gfp_mask & __GFP_KMEMLEAK)) + return false; if (fail_page_alloc.ignore_gfp_reclaim && (gfp_mask & __GFP_DIRECT_RECLAIM)) return false; > > -- > Michal Hocko > SUSE Labs > -- Regards, Chunyu Hu