Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2549254imm; Fri, 24 Aug 2018 00:53:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYK2FnDGqCmijCP22+3fR00xPO422MGsrVzRMEDEZLlFO67T9ypK1W45ufKKkYq9iX1CeMQ X-Received: by 2002:a17:902:6e0f:: with SMTP id u15-v6mr597205plk.13.1535097207805; Fri, 24 Aug 2018 00:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535097207; cv=none; d=google.com; s=arc-20160816; b=xbHOB3q6A1Jkla+UtarrUWJUPr3UPnFqHmfdUHsdZtx2fGvxOlMmLF+ZEyrpQH01yc EykugSOj2rCVcCld1xz1OyOk3TElu8IcsuK65zbAUToRLnG5LobYOWrfGkaBuWbmY/4c TFoT2ZWS/wyGlsatRsqlv5C1FF2a9soP+uz7zbUuGex5+rk46pWcrV0f6a02liD1vPvT nwvJ2ZHPVcICT7SgXndTMrXeG/vScvj1VjCHC4gCI6WTPEg4wRy1qNAOPkPiBd+3Y+SO gV5XiTGKNEXSujd2wvY/50GLipuzKOEXFmM2h25Ejql0wpG9KpIW9xukH20c5WNzEgz/ JFpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=xz/hiZNS7U6n2RlCc0jkWcYnBS4Ni4dVX6QrENHFiYI=; b=AuXeXFovUSUY0QdslERua9BO9yf6+ZYNXNDnc+Ske94PfSWl/ykkBmJxszh21cGTa1 pjoh5bCuOF5YqtSEu31MKPYu7n2skB/HsOGgFeOf+lbP+Wq83KqWj5tFJd6NUd3PqdQt ghLmn41zeWYG8X1WtAxn8c+ClBSEK5h/R3YIhJ1WwnSZlL9rbtXTYIdYzU7kAHRfEAiA bkK/aBAESdwrp1oT91QzvvkvYdgXS8E3gR4BACyiuEN+962JJA/DsJheNHY22hs+52eH ODolVJoZ/UOYmtFo5jhWgn6OPwNcEcg8EDebnWapGsGHoCs8bUiSg5fA6RGXMG/Vu0kD GmDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12-v6si2456209pgh.313.2018.08.24.00.53.12; Fri, 24 Aug 2018 00:53:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727756AbeHXLZ3 (ORCPT + 99 others); Fri, 24 Aug 2018 07:25:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:53820 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726969AbeHXLZ3 (ORCPT ); Fri, 24 Aug 2018 07:25:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D2C89AF6F; Fri, 24 Aug 2018 07:52:01 +0000 (UTC) Date: Fri, 24 Aug 2018 09:52:01 +0200 From: Michal Hocko To: Roman Gushchin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, Johannes Weiner , Andy Lutomirski , Konstantin Khlebnikov , Tejun Heo , Shakeel Butt Subject: Re: [PATCH v2 1/3] mm: rework memcg kernel stack accounting Message-ID: <20180824075201.GZ29735@dhcp22.suse.cz> References: <20180821213559.14694-1-guro@fb.com> <20180822141213.GO29735@dhcp22.suse.cz> <20180823162347.GA22650@tower.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180823162347.GA22650@tower.DHCP.thefacebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 23-08-18 09:23:50, Roman Gushchin wrote: > On Wed, Aug 22, 2018 at 04:12:13PM +0200, Michal Hocko wrote: [...] > > > @@ -248,9 +253,20 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) > > > static inline void free_thread_stack(struct task_struct *tsk) > > > { > > > #ifdef CONFIG_VMAP_STACK > > > - if (task_stack_vm_area(tsk)) { > > > + struct vm_struct *vm = task_stack_vm_area(tsk); > > > + > > > + if (vm) { > > > int i; > > > > > > + for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) { > > > + mod_memcg_page_state(vm->pages[i], > > > + MEMCG_KERNEL_STACK_KB, > > > + -(int)(PAGE_SIZE / 1024)); > > > + > > > + memcg_kmem_uncharge(vm->pages[i], > > > + compound_order(vm->pages[i])); > > > > when do we have order > 0 here? > > I guess, it's not possible, but hard-coded 1 looked a bit crappy. > Do you think it's better? I guess you meant 0 here. Well, I do not mind, I was just wondering whether I am missing something. -- Michal Hocko SUSE Labs