Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1045665iob; Fri, 13 May 2022 20:56:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoXKfpKm73z7zmWOVN8XDVADJpyHlrLt1AYrm5DYmaFkjqORdQfWt9MuCy5QsNLW+fZIP6 X-Received: by 2002:a05:6000:718:b0:20c:c39e:867e with SMTP id bs24-20020a056000071800b0020cc39e867emr6177299wrb.599.1652500567361; Fri, 13 May 2022 20:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652500567; cv=none; d=google.com; s=arc-20160816; b=qPgvXjootP02kzwB5U+ziItAZcQJ0vPDLELgi9XUvTn/sY1lnbccCOo3MwOLCSKD/Q eB/wJLYEjJlnZD/mUM4V5TxZAZl28qoTRQEA+3cgTFbk4lv6kBEoeo5HbZXLV+zJLeRG D2LF/LtqkbLqpBCv3+Xy5mTayPWADv8iv7BPSNkMQmEMTelEkbjTijDpdPr0r/IC6ouJ yVkQAmnhKMeWFtk/Ic8ynej2xthQtqOmXaXN+TLQjIuDLHozQyxWtU9nT8lw0p8CVTDE Q4Q9s2AKBNoyXqcbA82RvrFhRLLGMOea+4q7J7M/359wtVhJBKyp65RnNnbTqLsBqsFe xyAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pUiCnPMeV2tewEXDSR1Opfl8CW/W1nTXt/fBcyuE7po=; b=ZgsyhoR5nD56m1m9voxoBxUgKkGmC+SookJ91lyXRWdVx3k2lY3Qv8TpjgJuJie3eg swNgPyyet87x3m8GI2qb1YiRfdzLWcxbyurdnqDOcKsw2nS37dnHXNRCAo5J/Z5lyk9V 0EdfUAF7ncdSs9xF8EamPWogsA4KhXC9ODGtcQDGYP2NR/7rc5wfTFn/s+CQ6yZmug7e czH+67Nx0gCUZIAw1qyIP2DprCs5yl2OIVUn9QXbiCMLzJegNJPWuDsDpxbXUwQOb+SF KfFAw85wsCT/mYW1ln+qfmjTzZ5iIdWHOpWpCyHHRNq1xPHkpBc5BaZNUiAlHaO93oKp UEgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=hcbrT8LB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 9-20020a056000156900b0020ac76df727si4588735wrz.1015.2022.05.13.20.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:56:07 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=hcbrT8LB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 269D24911D9; Fri, 13 May 2022 17:28:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382944AbiEMRXv (ORCPT + 99 others); Fri, 13 May 2022 13:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376461AbiEMRXs (ORCPT ); Fri, 13 May 2022 13:23:48 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0906D53A7A for ; Fri, 13 May 2022 10:23:48 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d22so8564092plr.9 for ; Fri, 13 May 2022 10:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pUiCnPMeV2tewEXDSR1Opfl8CW/W1nTXt/fBcyuE7po=; b=hcbrT8LB9KtUyOFhJcjNGDoACadQCvR45e8T6zhTyidWst7gm9QCPlPUMus2qyKZO5 F5DqklOOcurOuJJoDyNyaahuz9kll92/JgnSl7AlqgPH+K3Sn2fBXIsuvf7m/+R6yAVS fsGK3TwUuxHbSqM+peiMHJozwxnh0TRDv3ZGQTeyAIlOMdMVBvwteTZ4PytPmR9t47Gg pqGrxwTsmpv7IbPbGbuf/rmrhjr8qRe8wpa4F75swNWUD2SfEYFj+qQV2DV/gexKRIvo 8snEpImCqQT57ffaUneyHTR7IkLcLcdzbaRzu3MoseaxEL7zq3AKDZum93Mv0C+hXL9+ x1Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pUiCnPMeV2tewEXDSR1Opfl8CW/W1nTXt/fBcyuE7po=; b=Wc0TgOOVylb07zIYvqo/t6aUWYH9Ip2h/fZ7OfneHkjRDIOBGkAQOJBRuE+0qIMA+x v37m/0vu8iipDmvjoZulWLDyZgtVmhZ+TEFfVI3aqw2YQsYm5RT5qn9FJB4kPYgYLQEl I+Rl/0p9gKaaa4IoGx/3BrdKTL14Y32maKjI++5ifXYFkdiyKR1SqPeCTSpfEDChXgni 3nw++S4hmtHEDvOnlYx4Od3u5/4cBLm47J9m4P/nktFmbyLhDLZS2D+tOPSbdogPoQiz Z+26iRZ6zyvZiFo3ah3ocPANHPi/gt7F49M9+XTBa+AL9ndnus77Zuq4fMbFqSbobpuz KMMA== X-Gm-Message-State: AOAM5300zrbtQ/i5VeBMWTYk/q7QqJUInK7bK/S4NqhESVmJFogWte52 uqbVnDEl7qAKltoAQzhhJ78qlgMe7iSrxHsUA+bPYw== X-Received: by 2002:a17:902:b094:b0:15c:dee8:74c8 with SMTP id p20-20020a170902b09400b0015cdee874c8mr5479352plr.6.1652462627392; Fri, 13 May 2022 10:23:47 -0700 (PDT) MIME-Version: 1.0 References: <20220510152847.230957-1-hannes@cmpxchg.org> <20220510152847.230957-7-hannes@cmpxchg.org> In-Reply-To: <20220510152847.230957-7-hannes@cmpxchg.org> From: Shakeel Butt Date: Fri, 13 May 2022 10:23:36 -0700 Message-ID: Subject: Re: [PATCH v2 6/6] zswap: memcg accounting To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Seth Jennings , Dan Streetman , Minchan Kim , Linux MM , Cgroups , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 10, 2022 at 8:29 AM Johannes Weiner wrote: > [...] > +void obj_cgroup_charge_zswap(struct obj_cgroup *objcg, size_t size) > +{ > + struct mem_cgroup *memcg; > + > + VM_WARN_ON_ONCE(!(current->flags & PF_MEMALLOC)); > + > + /* PF_MEMALLOC context, charging must succeed */ ) Instead of these warnings and comment why not just explicitly use memalloc_noreclaim_[save|restore]() ? > + if (obj_cgroup_charge(objcg, GFP_KERNEL, size)) Can we please make this specific charging an opt-in feature or at least provide a way to opt-out? This will impact users/providers where swap is used transparently (in terms of memory usage). Also do you want this change for v1 users as well? > + VM_WARN_ON_ONCE(1); > + > + rcu_read_lock(); > + memcg = obj_cgroup_memcg(objcg); > + mod_memcg_state(memcg, MEMCG_ZSWAP_B, size); > + mod_memcg_state(memcg, MEMCG_ZSWAPPED, 1); > + rcu_read_unlock(); > +} > +