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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8542AC6FA82 for ; Tue, 13 Sep 2022 07:59:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEA018D0001; Tue, 13 Sep 2022 03:59:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C72886B0073; Tue, 13 Sep 2022 03:59:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1E3B8D0001; Tue, 13 Sep 2022 03:59:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9DC486B0072 for ; Tue, 13 Sep 2022 03:59:04 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 78B8D1C67E7 for ; Tue, 13 Sep 2022 07:59:04 +0000 (UTC) X-FDA: 79906311408.16.541E45C Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 8CB5018009C for ; Tue, 13 Sep 2022 07:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZSuHqErBdLq/WjJ+4mcD880q8RV5cT2VvtIHCgGu7tA=; b=XKsiu+BkB0bgK7rldV7WiuPw5j e66tuTB0BowARIzVPTyQblNFQnpVVLLnFOW70jgMgJRCelISL57ZGUGsuG9B/hSGvZwCrNDqJYi3V wQntdW3RfHV800/1iU4ZBPCSYkRzPDa2goPomk3ijOTcBrahxNxz3sUiiv1PSaijRi6Sdr51LbQBt 40k6K/mBev1+LP+HHeHoArRbGWNmSEMP/sPHZ3OHKO0CqL3kRKjYDhCoE449sFZOco5xjQ6oWTdeL 8gKb6s7WQH3pCqcKYDrNLCnOIZOz9aI+cpiqbrTmBnGP3eZx++sp4ZifobZk32K4gaONjb3jJqfvQ XsX7HcXQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oY0op-00GhZw-Km; Tue, 13 Sep 2022 07:58:55 +0000 Date: Tue, 13 Sep 2022 08:58:55 +0100 From: Matthew Wilcox To: Anshuman Khandual Cc: Miaohe Lin , akpm@linux-foundation.org, david@redhat.com, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/16] mm/page_alloc: ensure kswapd doesn't accidentally go to sleep Message-ID: References: <20220909092451.24883-1-linmiaohe@huawei.com> <20220909092451.24883-2-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663055943; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZSuHqErBdLq/WjJ+4mcD880q8RV5cT2VvtIHCgGu7tA=; b=LTh/u1r06kz4N0C0Ax5079Gc0Ww9R0DSrzDnjgGmMp7j2jJ+k2+X6CbLfpSbcKGHy48Cd9 Z/hFUbhpF04l6MplmLwP1Kw/kueliMMtC2fUdNJ4n9JhnXU0m3GOiqa7ZFZ3NZ+iQBb3HA PSQRYhKCKye+P21FSsZUIDBOyUOGocQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=XKsiu+Bk; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663055943; a=rsa-sha256; cv=none; b=zIsb/GOHOgStNrqtG9kJI39rrDPzqkO5kaWP2SqDHK3VP3qgFsFPW0y+8Sz1aTB3DsFix6 ll+7f9FnYeMYu2X8hJIyvkDKO7ML6izlZ3rHuUwr6wuPUomIpZy9U4UQ6S8wlhIGrnudge pttf0p0Vtzj0F8YLolwK6NszNavF9P4= X-Stat-Signature: mxdsfq8un1so3baymoc6xewtn9q5unio X-Rspamd-Queue-Id: 8CB5018009C Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=XKsiu+Bk; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1663055942-351103 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Sep 13, 2022 at 12:32:50PM +0530, Anshuman Khandual wrote: > > > On 9/9/22 14:54, Miaohe Lin wrote: > > If ALLOC_KSWAPD is set, wake_all_kswapds() will be called to ensure > > kswapd doesn't accidentally go to sleep. But when reserve_flags is > > set, alloc_flags will be overwritten and ALLOC_KSWAPD is thus lost. > > Preserve the ALLOC_KSWAPD flag in alloc_flags to ensure kswapd won't > > go to sleep accidentally. > > Currently wake_all_kswapds() gets skipped subsequently if ALLOC_KSWAPD > is lost, but this only happens when the 'retry:' loops is taken ? Right, but see the comment: /* Ensure kswapd doesn't accidentally go to sleep as long as we loop */ and that is not currently true. I think that was an inadvertent change. Particularly since the changelog for 0a79cdad5eb2 says "No functional change". > > > > Fixes: 0a79cdad5eb2 ("mm: use alloc_flags to record if kswapd can wake") > > Signed-off-by: Miaohe Lin > > --- > > mm/page_alloc.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index ba5c9402a5cb..4b97a03fa2dd 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -5147,7 +5147,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > > > > reserve_flags = __gfp_pfmemalloc_flags(gfp_mask); > > if (reserve_flags) > > - alloc_flags = gfp_to_alloc_flags_cma(gfp_mask, reserve_flags); > > + alloc_flags = gfp_to_alloc_flags_cma(gfp_mask, reserve_flags) | > > + (alloc_flags & ALLOC_KSWAPD); > > > > /* > > * Reset the nodemask and zonelist iterators if memory policies can be >