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 X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2411BCA90AF for ; Tue, 12 May 2020 17:16:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC106205ED for ; Tue, 12 May 2020 17:16:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC106205ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 60F319000D6; Tue, 12 May 2020 13:16:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C128900036; Tue, 12 May 2020 13:16:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 461FE9000D6; Tue, 12 May 2020 13:16:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 28C4E900036 for ; Tue, 12 May 2020 13:16:56 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D1BEE8248D7C for ; Tue, 12 May 2020 17:16:55 +0000 (UTC) X-FDA: 76808721990.13.page24_76ab55bcf241b X-HE-Tag: page24_76ab55bcf241b X-Filterd-Recvd-Size: 9365 Received: from mail-oo1-f65.google.com (mail-oo1-f65.google.com [209.85.161.65]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 May 2020 17:16:55 +0000 (UTC) Received: by mail-oo1-f65.google.com with SMTP id v6so2872248oou.4 for ; Tue, 12 May 2020 10:16:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zrV9Na5hegEtMEkEu1KEFc/uSwqOLQP7YJGf/jtNHQc=; b=nDAJHhMgpTqhkBU3TORwTi0DlXP6EgjMtfqctSuH5kY2ztPQg/fODWbJDQCi/QmOqz dirvPlsJ2UY9Ixu4gBK++p4QK9ABOItLtlVpuNr8a3urRWWZo1MbS1EWzJ5toXPCqQsA vpRFSUz0SH0EN3vOL8X5oRHrqsW3YSL2imtfyN9yuuU0QnL3oNa44A3qADfyYPqYf7AV 1hYraGAmBI63sACjLITqh2RZnwl8BUmcsI2bE+Ci5dUYxzYarOqyxIkM4b5FXYTsrj1Q xS6bRudfzNhlIzUSMXpyS1W5Xd20yeoi/j9c5a/OCijurO9NeRsjSLgjPj4/0nYDfy1R iYyg== X-Gm-Message-State: AGi0PubqGCObRfLL1NEn778/CGE+2kzWHfXRhGpQSXjHKV+B13Y2ByI8 vB9tfDgFbEw8AOjRZ6bhtK8ViuQVNECvm2Rm5yM= X-Google-Smtp-Source: APiQypJ90cuUdqwS9GCMEDW5toqUx3hGQCswz4bCNJ1HffyAlcgQWXh/NB2EC2pbtqykmvgZCLvi8ISszTO5rm0LxwI= X-Received: by 2002:a4a:d44a:: with SMTP id p10mr19049986oos.11.1589303814627; Tue, 12 May 2020 10:16:54 -0700 (PDT) MIME-Version: 1.0 References: <20200511224430.HDJjRC68z%akpm@linux-foundation.org> <3b612c3e-ce52-ba92-eb02-0fa7fd38819f@infradead.org> <20200512121750.GA397968@cmpxchg.org> In-Reply-To: <20200512121750.GA397968@cmpxchg.org> From: Geert Uytterhoeven Date: Tue, 12 May 2020 19:16:43 +0200 Message-ID: Subject: Re: mmotm 2020-05-11-15-43 uploaded (mm/memcontrol.c, huge pages) To: Johannes Weiner Cc: Randy Dunlap , Andrew Morton , Mark Brown , Linux FS Devel , Linux Kernel Mailing List , Linux MM , Linux-Next , Michal Hocko , mm-commits@vger.kernel.org, Stephen Rothwell Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: Hi Johannes, On Tue, May 12, 2020 at 2:20 PM Johannes Weiner wrote: > On Mon, May 11, 2020 at 09:41:24PM -0700, Randy Dunlap wrote: > > On 5/11/20 3:44 PM, Andrew Morton wrote: > > > The mm-of-the-moment snapshot 2020-05-11-15-43 has been uploaded to > > > > > > http://www.ozlabs.org/~akpm/mmotm/ > > > > > > mmotm-readme.txt says > > > > > > README for mm-of-the-moment: > > > > > > http://www.ozlabs.org/~akpm/mmotm/ > > > > > > This is a snapshot of my -mm patch queue. Uploaded at random hopeful= ly > > > more than once a week. > > > > > > You will need quilt to apply these patches to the latest Linus releas= e (5.x > > > or 5.x-rcY). The series file is in broken-out.tar.gz and is duplicat= ed in > > > http://ozlabs.org/~akpm/mmotm/series > > > > > > The file broken-out.tar.gz contains two datestamp files: .DATE and > > > .DATE-yyyy-mm-dd-hh-mm-ss. Both contain the string yyyy-mm-dd-hh-mm-= ss, > > > followed by the base kernel version against which this patch series i= s to > > > be applied. > > > > > > This tree is partially included in linux-next. To see which patches = are > > > included in linux-next, consult the `series' file. Only the patches > > > within the #NEXT_PATCHES_START/#NEXT_PATCHES_END markers are included= in > > > linux-next. > > > > > > > > > A full copy of the full kernel tree with the linux-next and mmotm pat= ches > > > already applied is available through git within an hour of the mmotm > > > release. Individual mmotm releases are tagged. The master branch al= ways > > > points to the latest release, so it's constantly rebasing. > > > > > > https://github.com/hnaz/linux-mm > > > > > > The directory http://www.ozlabs.org/~akpm/mmots/ (mm-of-the-second) > > > contains daily snapshots of the -mm tree. It is updated more frequen= tly > > > than mmotm, and is untested. > > > > > > A git copy of this tree is also available at > > > > > > https://github.com/hnaz/linux-mm > > Thanks for the report, Randy. > > --- > > Randy reports: > > > on x86_64: > > > > In file included from ../arch/x86/include/asm/atomic.h:5:0, > > from ../include/linux/atomic.h:7, > > from ../include/linux/page_counter.h:5, > > from ../mm/memcontrol.c:25: > > ../mm/memcontrol.c: In function =E2=80=98memcg_stat_show=E2=80=99: > > ../include/linux/compiler.h:394:38: error: call to =E2=80=98__compileti= me_assert_383=E2=80=99 declared with attribute error: BUILD_BUG failed > > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER_= _) > > ^ > > ../include/linux/compiler.h:375:4: note: in definition of macro =E2=80= =98__compiletime_assert=E2=80=99 > > prefix ## suffix(); \ > > ^~~~~~ > > ../include/linux/compiler.h:394:2: note: in expansion of macro =E2=80= =98_compiletime_assert=E2=80=99 > > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER_= _) > > ^~~~~~~~~~~~~~~~~~~ > > ../include/linux/build_bug.h:39:37: note: in expansion of macro =E2=80= =98compiletime_assert=E2=80=99 > > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > ^~~~~~~~~~~~~~~~~~ > > ../include/linux/build_bug.h:59:21: note: in expansion of macro =E2=80= =98BUILD_BUG_ON_MSG=E2=80=99 > > #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") > > ^~~~~~~~~~~~~~~~ > > ../include/linux/huge_mm.h:319:28: note: in expansion of macro =E2=80= =98BUILD_BUG=E2=80=99 > > #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) > > The THP page size macros are CONFIG_TRANSPARENT_HUGEPAGE only. > > We already ifdef most THP-related code in memcg, but not these > particular stats. Memcg used to track the pages as they came in, and > PageTransHuge() + hpage_nr_pages() work when THP is not compiled in. > > Switching to native vmstat counters, memcg doesn't see the pages, it > only gets a count of THPs. To translate that to bytes, it has to know > how big the THPs are - and that's only available for CONFIG_THP. > > Add the necessary ifdefs. /proc/meminfo, smaps etc. also don't show > the THP counters when the feature is compiled out. The event counts > (THP_FAULT_ALLOC, THP_COLLAPSE_ALLOC) were already conditional also. > > Style touchup: HPAGE_PMD_NR * PAGE_SIZE is silly. Use HPAGE_PMD_SIZE. > > Reported-by: Randy Dunlap > Signed-off-by: Johannes Weiner > --- > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 738d071ba1ef..47c685088a2c 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1401,9 +1401,11 @@ static char *memory_stat_format(struct mem_cgroup = *memcg) > (u64)memcg_page_state(memcg, NR_WRITEBACK) * > PAGE_SIZE); > > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > seq_buf_printf(&s, "anon_thp %llu\n", > (u64)memcg_page_state(memcg, NR_ANON_THPS) * > - HPAGE_PMD_NR * PAGE_SIZE); > + HPAGE_PMD_SIZE); > +#endif > > for (i =3D 0; i < NR_LRU_LISTS; i++) > seq_buf_printf(&s, "%s %llu\n", lru_list_name(i), > @@ -3752,7 +3754,9 @@ static int memcg_numa_stat_show(struct seq_file *m,= void *v) > static const unsigned int memcg1_stats[] =3D { > NR_FILE_PAGES, > NR_ANON_MAPPED, > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > NR_ANON_THPS, > +#endif > NR_SHMEM, > NR_FILE_MAPPED, > NR_FILE_DIRTY, > @@ -3763,7 +3767,9 @@ static const unsigned int memcg1_stats[] =3D { > static const char *const memcg1_stat_names[] =3D { > "cache", > "rss", > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > "rss_huge", > +#endif > "shmem", > "mapped_file", > "dirty", > @@ -3794,8 +3800,10 @@ static int memcg_stat_show(struct seq_file *m, voi= d *v) > if (memcg1_stats[i] =3D=3D MEMCG_SWAP && !do_memsw_accoun= t()) > continue; > nr =3D memcg_page_state_local(memcg, memcg1_stats[i]); > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > if (memcg1_stats[i] =3D=3D NR_ANON_THPS) > nr *=3D HPAGE_PMD_NR; > +#endif > seq_printf(m, "%s %lu\n", memcg1_stat_names[i], nr * PAGE= _SIZE); > } Fixes the build issue with m68k/allmodconfig, too. Not boot-tested. Gr{oetje,eeting}s, Geert --=20 Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k= .org In personal conversations with technical people, I call myself a hacker. Bu= t when I'm talking to journalists I just say "programmer" or something like t= hat. -- Linus Torvalds