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 05E95C4332F for ; Thu, 13 Oct 2022 04:05:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B1046B0071; Thu, 13 Oct 2022 00:05:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 060596B0073; Thu, 13 Oct 2022 00:05:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E43466B0074; Thu, 13 Oct 2022 00:05:12 -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 D347D6B0071 for ; Thu, 13 Oct 2022 00:05:12 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9AB2414017A for ; Thu, 13 Oct 2022 04:05:12 +0000 (UTC) X-FDA: 80014586064.09.7811649 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf24.hostedemail.com (Postfix) with ESMTP id 4FAD418002E for ; Thu, 13 Oct 2022 04:05:12 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id l1-20020a17090a72c100b0020a6949a66aso886710pjk.1 for ; Wed, 12 Oct 2022 21:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8++WI2cB9cLDorIe3CMpDCvK7dTWV1cZarVzqx3Q8ko=; b=QoMAkPZR2s/9mh6z5NesmgaH9PxD8SZ0UocJKumuHdLnwHhyAgawHy+OKUMhF0su4+ 48C6vUCMIuys8ybRZyuyuv8rQD0YniayJkgetcaw3AAy/H41Z7Nk6EIMBwS+0CGkduLI A43TwjfVlB0qhSJNRwkUXf1GfQ8zeiLRwb3uefzWaMUK2pc36vJymFDjIYFO9fM6y/2A 1exw9RUTaswJiNEbTcb/vyoWss0Ddz0QT8CsKGQotGK0Ixb1iFZ30REunvUU7mIsVf3O KV+Z/ToGGx5pPFDn2Mm+K/BwcE5B4uZu91SeuJN3+6khHwE8Ro/iEWbObwH1QYTBR+aJ IPVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8++WI2cB9cLDorIe3CMpDCvK7dTWV1cZarVzqx3Q8ko=; b=jq3E8tQVC2zgeSS2jVRjSRcq0VZ0Ba4X3ySra3ehf4onjxC3SjKa89d9OxfOwePm/d LZayK2Ij9ZoErwuh/rNER4gNabTizWwLTsuE+tTO8QtzMehcyIzgS1+Lzf6uj4mt7exH LZ2hCSs7H/dAls+J2OdeKUuqGP/113Q7y7X01zmCqP10S/uJ9j+w9OQxfj2HkziYEHs6 Ht7JM0LsKwsuqj8TmwUq6NpJ7nZn99pXow7ypcmhtwMtgfiJ4vSwROnXX8UrFFQf1QwZ aKFaPJ6FJwq9yvnxrG6i4xA2lkbQc6I1imVfVgfaxtjEImnSJyJk+sB0UOdeUdrp6Q1w 8iqQ== X-Gm-Message-State: ACrzQf2FPqpi1QChfk3kl0+j4Ki1mQWcF83UiYZfSrBVYrw7REhLzWu7 ECQ8FfdTQkgs7xLyNqtA44YUbB9tiiHyv6lEjIn3iQ== X-Google-Smtp-Source: AMsMyM6d0+w31svVHcuaYHAg3BuV3ceMvwAiuUxuiWsJk9qimEic/dUD/yMrEwf4UJYpeMjbm/iUpYNmyukYK2LGrwo= X-Received: by 2002:a17:90a:d390:b0:20d:3b10:3811 with SMTP id q16-20020a17090ad39000b0020d3b103811mr8909675pju.211.1665633911035; Wed, 12 Oct 2022 21:05:11 -0700 (PDT) MIME-Version: 1.0 References: <20210817194003.2102381-1-weiwan@google.com> <20221012163300.795e7b86@kernel.org> <20221012173825.45d6fbf2@kernel.org> <20221013005431.wzjurocrdoozykl7@google.com> <20221012184050.5a7f3bde@kernel.org> <20221012201650.3e55331d@kernel.org> <20221012204941.3223d205@kernel.org> In-Reply-To: <20221012204941.3223d205@kernel.org> From: Wei Wang Date: Wed, 12 Oct 2022 21:04:59 -0700 Message-ID: Subject: Re: [PATCH net-next] net-memcg: pass in gfp_t mask to mem_cgroup_charge_skmem() To: Jakub Kicinski Cc: Shakeel Butt , Eric Dumazet , netdev@vger.kernel.org, "David S . Miller" , cgroups@vger.kernel.org, linux-mm@kvack.org, Roman Gushchin Content-Type: text/plain; charset="UTF-8" ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=QoMAkPZR; spf=pass (imf24.hostedemail.com: domain of weiwan@google.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=weiwan@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665633912; a=rsa-sha256; cv=none; b=tA4V4XOOo0EIU6ShEB9RqruQn2XCZdv4lDfttYKRAlKJMcSF8nzOaVIhKbv4MiZNjg4Het tXt1HNu42s8gxXtYHbDhS9EEgNYKTBm5AjLQGAH5abN1G/ENlbsa2Wx1g8aD6pt/if4ZuF zkpJ09dEXZ9yApnS7UqLJqz8MK3m0hQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665633912; 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=8++WI2cB9cLDorIe3CMpDCvK7dTWV1cZarVzqx3Q8ko=; b=7M2BcVQPN4UwdJ2qB6V3o3PGMDhmJySHvea414qxio+e2mpQqmvkouomgedqqZaKNrFjyz 1mXiC3UeciQUWhk+nXJOqUgY2tSlmmADceRNE1H5RBUQYcxumJiRMmndSnUM5gozbmenHj sNeUYYO6WfGOjIlAbmmYDuVo+gQNbKg= X-Rspamd-Server: rspam05 X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=QoMAkPZR; spf=pass (imf24.hostedemail.com: domain of weiwan@google.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=weiwan@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: iz3say9n9ocskn9tgbymxfwb7p4k8sjn X-Rspamd-Queue-Id: 4FAD418002E X-HE-Tag: 1665633912-697953 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 Wed, Oct 12, 2022 at 8:49 PM Jakub Kicinski wrote: > > On Wed, 12 Oct 2022 20:34:00 -0700 Wei Wang wrote: > > > I pushed this little nugget to one affected machine via KLP: > > > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > > index 03ffbb255e60..c1ca369a1b77 100644 > > > --- a/mm/memcontrol.c > > > +++ b/mm/memcontrol.c > > > @@ -7121,6 +7121,10 @@ bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages, > > > return true; > > > } > > > > > > + if (gfp_mask == GFP_NOWAIT) { > > > + try_charge(memcg, gfp_mask|__GFP_NOFAIL, nr_pages); > > > + refill_stock(memcg, nr_pages); > > > + } > > > return false; > > > } > > > > > AFAICT, if you force charge by passing __GFP_NOFAIL to try_charge(), > > you should return true to tell the caller that the nr_pages is > > actually being charged. > > Ack - not sure what the best thing to do is, tho. Always pass NOFAIL > in softirq? > > It's not clear to me yet why doing the charge/uncharge actually helps, > perhaps try_to_free_mem_cgroup_pages() does more when NOFAIL is passed? > I am curious to know as well. > I'll do more digging tomorrow. > > > Although I am not very sure what refill_stock() does. Does that > > "uncharge" those pages? > > I think so, I copied it from mem_cgroup_uncharge_skmem().