Received: by 10.192.165.148 with SMTP id m20csp2364812imm; Sun, 22 Apr 2018 05:53:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Adnqiiu5mDs+Cmc3nTLrVdOTC8oN72OHXPMHmPiQaheaCIFyd9DZk6LB4pDgmyFCmGc3g X-Received: by 2002:a17:902:7201:: with SMTP id ba1-v6mr16788060plb.283.1524401589373; Sun, 22 Apr 2018 05:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524401589; cv=none; d=google.com; s=arc-20160816; b=o57aJmdR9+ssbEUz+iu4t552TJ92C0JWVe04nxKU0LA9YBJD0wLKkGjsSMJS1jHt6y PaS4GfNt+ytSiN06KpS+4+AHTCbEkAdyvtJaF7a5+n5fj9KlTflKXHiJGfNXOHaatOYD ltof0hLhwrQPuztw/DL0qH2C/Td9nCwq5GFrtwZq47MyxuFt9a7sKkL6Z6mCG1g8j48f lFZpYfex1odCmIRU4vkYamEV3YFnVqms2OtvRVht/VOCt/E1b5WuSHilIRQEud3Vm6rH YWHArQruwf4LNvUtr9aQ56EXIxEnj/iuBDcVfSKjK+ItcAA7Rx1aIbqr9xNYpoNJPfDa rUZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=LmBBSuq7mL1kgTPtQ9EPPfwsTIL/gfQAFJMdYBRE3H0=; b=l2q+nRSUkpZM8pVUK2ZqsWyJFeiZl1rzugc3OebR8Rtiz646dn5FJfvsxHXDWpAxoa zg3p1ul3YUmZtwt5lAN5geHNjx/5iIS2Gy1uG9nSucoknze0HXXn1rqmFPFvp1BPhbSa bsrLL0W5D6LDkrIdIMTEsVzYTFnSnNAZ+x7GzPuQ4+exLDUP5y1wOa595yzL84cJfBeS yVG1EVVWDAyvr5T3Uy3/qwRNkesZVhrMuYOuUOnkv83DDogC2PYqSw6yi3sKSskCGXxT +QKftM9T9Sw3BplIRz7sz9bwyYJz8U1hl7fhDUyfQbr6GS7TR5k30/wh4wco8zrajUsO +E9A== 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 31-v6si9498380plj.101.2018.04.22.05.52.53; Sun, 22 Apr 2018 05:53:09 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751560AbeDVMvq (ORCPT + 99 others); Sun, 22 Apr 2018 08:51:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:52059 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbeDVMvp (ORCPT ); Sun, 22 Apr 2018 08:51:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4B014ABEC; Sun, 22 Apr 2018 12:51:44 +0000 (UTC) Date: Sun, 22 Apr 2018 06:51:41 -0600 From: Michal Hocko To: Catalin Marinas Cc: Chunyu Hu , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dmitry Vyukov Subject: Re: [RFC] mm: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in gfp_kmemleak_mask Message-ID: <20180422125141.GF17484@dhcp22.suse.cz> References: <1524243513-29118-1-git-send-email-chuhu@redhat.com> <20180420175023.3c4okuayrcul2bom@armageddon.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180420175023.3c4okuayrcul2bom@armageddon.cambridge.arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 20-04-18 18:50:24, Catalin Marinas wrote: > On Sat, Apr 21, 2018 at 12:58:33AM +0800, Chunyu Hu wrote: > > __GFP_NORETRY and __GFP_NOFAIL are combined in gfp_kmemleak_mask now. > > But it's a wrong combination. As __GFP_NOFAIL is blockable, but > > __GFP_NORETY is not blockable, make it self-contradiction. > > > > __GFP_NOFAIL means 'The VM implementation _must_ retry infinitely'. But > > it's not the real intention, as kmemleak allow alloc failure happen in > > memory pressure, in that case kmemleak just disables itself. > > Good point. The __GFP_NOFAIL flag was added by commit d9570ee3bd1d > ("kmemleak: allow to coexist with fault injection") to keep kmemleak > usable under fault injection. > > > commit 9a67f6488eca ("mm: consolidate GFP_NOFAIL checks in the allocator > > slowpath") documented that what user wants here should use GFP_NOWAIT, and > > the WARN in __alloc_pages_slowpath caught this weird usage. > > > > > > WARNING: CPU: 3 PID: 64 at mm/page_alloc.c:4261 __alloc_pages_slowpath+0x1cc3/0x2780 > [...] > > Replace the __GFP_NOFAIL with GFP_NOWAIT in gfp_kmemleak_mask, __GFP_NORETRY > > and GFP_NOWAIT are in the gfp_kmemleak_mask. So kmemleak object allocaion > > is no blockable and no reclaim, making kmemleak less disruptive to user > > processes in pressure. > > It doesn't solve the fault injection problem for kmemleak (unless we > change __should_failslab() somehow, not sure yet). An option would be to > replace __GFP_NORETRY with __GFP_NOFAIL in kmemleak when fault injection > is enabled. Cannot we simply have a disable_fault_injection knob around the allocation rather than playing this dirty tricks with gfp flags which do not make any sense? > BTW, does the combination of NOWAIT and NORETRY make kmemleak > allocations more likely to fail? NOWAIT + NORETRY simply doesn't make much sesne. It is equivalent to NOWAIT. -- Michal Hocko SUSE Labs