From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4153C433EF for ; Wed, 19 Jan 2022 06:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YfuwiAWJSSGpDEXqwiOApHEzejq9kd6nhBVekpv6G4k=; b=gcN//S7S44b6jY Vo+p2YDcvWYycMHphMKoZ/ToDu9QMUzUeBNpfNeMedTeQrqqp0k5ROYggTfiU3W/ptPB/PbhrRl/t UPnSekP3J8ww9VzYZYpxL6K4nggsgE3k1v54LHM3CqqWE4z1L7Hj+JXj2yCIOhpzKpMVkBx4yqr1v 47rg5HkoDgkKckhDl5JQzhP+PDIV/x0EMalNZDbJsijwbF84NWecTmwVZNmfkAdEXwxLmna+T8xCw NndBHB1asgdNNR1/IfhiWsqXoFgDal0llVX938NOJVtGGr+8U9Ybv9v9X1+sl863qoYraCpl+GclG uqdsriwXI3wWkyQFY78A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nA4V3-003xZH-1k; Wed, 19 Jan 2022 06:31:17 +0000 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nA4Uz-003xXj-5s for linux-arm-kernel@lists.infradead.org; Wed, 19 Jan 2022 06:31:14 +0000 Received: by mail-il1-x12b.google.com with SMTP id r3so884752iln.3 for ; Tue, 18 Jan 2022 22:31:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UkxAceZxhajO8BZgkx8KrSGLctag3Zj1oQU14fV01lI=; b=Al/uDi3lg+lN09USLdsbvITyPec67cN5Pi0OUqyCegJg47rd3VhCxspvMZpaV1wT+W SvDRoVhrHnzyuI9uW2Gx6O40x+11XZAEE1mWZ2oDkglCgZRBiuLMienpZwn1dXxuVxZa dVER1xf43OOVYL6tGrvttn0OgbDIUhu2z6BmdN4oPcA1YVTj2vsPuDVyX9N8naFPXLpf s43BvSzaDQpikXXCfDezMayLfKPfhBl4huxVeq4LT9q+BZkxCufxE84ehwGoJ6Eqw0RG d9oaa2p0Itw0RYje0YB8rgjkFpskE4CAwxsTR9a91PU+sHdLdt5Xk2nrxm0O8qiCQohR q4+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UkxAceZxhajO8BZgkx8KrSGLctag3Zj1oQU14fV01lI=; b=6tx49TYuuYpvUn7k7r3X5szsQ8uQFWk/5+y6MGHDhBy1GDiQzVb1Lz5R9gppXJZXqU OrsQ1ayGjvHhsagSkFp2D+DL6zhKFp1czxW/LmBDctoLqQPYu9eOo5xlcXz5Y65a/11c bH0JXGufit0dCH1cmKyIwFe6A973x64/yWJhvUFknaE0isPrGQyDmBQAPgLaUH+3xnC1 /Htc4281FHOqh/rHsIaWkhq8FK4DSyORweSqBFsC02WaZY90Gw/GvRI6d3lvEF9FSCf9 n0BODNgNY8fvXETfmWaMFQSxpMA1YLbso2mz+BA0ZdgOofdXN2r46J06LTPrIYN9G0QA IO5g== X-Gm-Message-State: AOAM533G6TCBxXNJtqYi5emAk+IxT5QnND2///7m4L0+sRRCioB8l2XW VokF+Fq51yTSP/x+P5oWST8c4g== X-Google-Smtp-Source: ABdhPJx6MTLpNNm2sOsjZA6EPUjb9C5/VI8R+cN1990w1Y2oviGcshouM6+huqzkXNgC6iBpgogcAg== X-Received: by 2002:a05:6e02:198a:: with SMTP id g10mr15789393ilf.280.1642573872028; Tue, 18 Jan 2022 22:31:12 -0800 (PST) Received: from google.com ([2620:15c:183:200:90fc:e0c9:c69f:bede]) by smtp.gmail.com with ESMTPSA id g5sm13398294ioo.21.2022.01.18.22.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 22:31:11 -0800 (PST) Date: Tue, 18 Jan 2022 23:31:07 -0700 From: Yu Zhao To: Michal Hocko Cc: Andrew Morton , Linus Torvalds , Andi Kleen , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, x86@kernel.org, Konstantin Kharlamov Subject: Re: [PATCH v6 6/9] mm: multigenerational lru: aging Message-ID: References: <20220104202227.2903605-1-yuzhao@google.com> <20220104202227.2903605-7-yuzhao@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220118_223113_268553_2614BDC2 X-CRM114-Status: GOOD ( 24.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jan 13, 2022 at 01:02:26PM +0100, Michal Hocko wrote: > On Thu 13-01-22 02:43:38, Yu Zhao wrote: > [...] > > > > The bottom line is I can try various optimizations, e.g., preallocate > > > > a few buffers for a limited number of page walkers and if this number > > > > has been reached, fallback to the rmap-based function. But I have yet > > > > to see evidence that calls for additional complexity. > > > > > > I would disagree here. This is not an optimization. You should be > > > avoiding allocations from the memory reclaim because any allocation just > > > add a runtime behavior complexity and potential corner cases. > > > > Would __GFP_NOMEMALLOC address your concern? It prevents allocations > > from accessing the reserves even under PF_MEMALLOC. > > __GFP_NOMEMALLOC would deal with the complete memory depletion concern > for sure but I am not sure how any of these allocations would succeed > when called from the direct reclaim. Some access to memory reserves is > necessary if you insist on allocating from the reclaim process. > > You can have a look at the limited memory reserves access by oom victims > for an example of how this can be done. Thanks. I'll change GFP_KERNEL to __GFP_HIGH | __GFP_NOMEMALLOC. __GFP_HIGH allows some access to memory reserves and __GFP_NOMEMALLOC prevents the complete depletion. Basically the combination lower the min watermark by 1/2, and we have been using them for add_to_swap_cache(). _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel