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 EC0E4C433F5 for ; Thu, 6 Jan 2022 21:42:49 +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=Z67132gUFYSVYQuEzGqalwax/kG/S5nGQ8e3L5ZXobk=; b=Z2x5aDtIsxTrPh O6/KHDsA77u9GyUzsis5E3/7PoMwmFuVzWizNRyrvKOBkRHT+88lRp1Oszts5nzUx5gwX8oHuFAtu JL3SmKRbmxgNrWmakYWSmxjIWAZGsMwQslzhydXSI+yZn3on7pyxHPerC1Agy3+/+sky8SAsFwhno t4+ynEiKro6sAmWHFY+wn/Z9Xe7vkPkrQGI363SNut56Nzq06pjo060OacvD/6cjJqVH4r/wZosv5 2bTWE448scaWJtixmhj9Pk+Ptkc1mosTm6zMz91XyvSe4t9o2+QDZ/DrLNx0xh4WA56vA3xY/YtiU Oeb+0zWA3GF4KYB/SzCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5aVc-001QSc-VR; Thu, 06 Jan 2022 21:41:21 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5aVa-001QRb-8w for linux-arm-kernel@lists.infradead.org; Thu, 06 Jan 2022 21:41:19 +0000 Received: by mail-il1-x12d.google.com with SMTP id 9so3121178ill.9 for ; Thu, 06 Jan 2022 13:41:17 -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=VE61gMKhpnWZvU6qcog2kgqC/TE+2QO5LS6iHCKhdqo=; b=X5251x9gOvT9jJO0fIYrghZ2dmsDZAjI/XaWW0c5hgerIpNSgvl0jSew1p/PD5Wl19 Vty9fxDz85jiNwo2PyrzeAVr0Qh4AvnoRBKBwKjqqN+gzpApKSZBr6PBW1Haplrbva6W fgVBMIb7yopx0RKQtKxR50gNsFKTWHXlfqc8oQFDrabFDnXtqIegt0iG6irvi38YWFd4 cgfZmbJs9Pm7/xTPZRLe5dj3S3L3BXmcfUDx4bs89c9lfEzBCjKIC2rQMHR8y1knN7k1 n9W9uyTNFGgs6Rt4Z59saMbeT0VmyuJ8EgZ8HHnKRgS+SJ6qUqkzzObvE1zCp+mjQO+F 5N6A== 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=VE61gMKhpnWZvU6qcog2kgqC/TE+2QO5LS6iHCKhdqo=; b=VvPA1XTEDrHcW/bIQ/jq5AT/qUgyZ7eDvRULoUJXMcsDYTDq6IAU0MK3aVGXTrNxjW 5JucDfp/HHaaYC7RycpoZmfh34WdHuUzJgOzhHJyghH8HYuSs91tcUZp9dFHlVhev4L2 9488RiFMcYTO2u00I5vZetnZ5xnrd6OYqc/7Oc900PocCCoysTuk3sa0AM/K9saNKTii Wh5/lMvN5mIHbH0TEWdNQ+cDXFRvBEUasgTEtaIFwMg+ZlrsXYdQr69HHQUIS4FtNNIn RmxlEJRijrsNosjB+mfzBvnBUivod3BVEd8mBGs+jFgA6ajF/hsOQi7uUDjvZvAG0uW1 mzcQ== X-Gm-Message-State: AOAM5334T7jCt1QejVVUx1ofs6qmxgKl7G5KU0hp9VHjJy8B+04qB0c0 8br19cimwIy7dysmga2efJX/9w== X-Google-Smtp-Source: ABdhPJy/UG+ITMyG2/Mn4Uwf8UspkeO6+lrYf7WWF5pbE5NdbTB0zBoFHkgaWyjBjeOtQvNFfxzAEw== X-Received: by 2002:a05:6e02:1945:: with SMTP id x5mr2005197ilu.288.1641505277173; Thu, 06 Jan 2022 13:41:17 -0800 (PST) Received: from google.com ([2620:15c:183:200:2e0a:5e5e:fac:e07b]) by smtp.gmail.com with ESMTPSA id r1sm1688447ilo.38.2022.01.06.13.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:41:16 -0800 (PST) Date: Thu, 6 Jan 2022 14:41:12 -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-20220106_134118_347577_60B8CF97 X-CRM114-Status: GOOD ( 14.52 ) 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 06, 2022 at 05:12:16PM +0100, Michal Hocko wrote: > On Tue 04-01-22 13:22:25, Yu Zhao wrote: > > +static struct lru_gen_mm_walk *alloc_mm_walk(void) > > +{ > > + if (!current->reclaim_state || !current->reclaim_state->mm_walk) > > + return kvzalloc(sizeof(struct lru_gen_mm_walk), GFP_KERNEL); > > + > > + return current->reclaim_state->mm_walk; > > +} > > + > > +static void free_mm_walk(struct lru_gen_mm_walk *walk) > > +{ > > + if (!current->reclaim_state || !current->reclaim_state->mm_walk) > > + kvfree(walk); > > +} > > Do I get it right that you are allocating from the reclaim context? What > prevents this to completely deplete the memory as the reclaim context is > PF_MEMALLOC? Yes, and in general the same reason zram/zswap/etc. allocate memory in the reclaim context: to make more free memory. In this case, lru_gen_mm_walk is small (160 bytes); it's per direct reclaimer; and direct reclaimers rarely come here, i.e., only when kswapd can't keep up in terms of the aging, which is similar to the condition where the inactive list is empty for the active/inactive lru. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel