Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp540616pxb; Thu, 15 Apr 2021 00:09:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUYesbbZ6W+mYai2/ZLUxcwG+ofk1hQQSIO/phpAuagqFdewHZ74rqIFKq/lFIJ+JGHYvF X-Received: by 2002:a63:4c55:: with SMTP id m21mr2277471pgl.251.1618470582905; Thu, 15 Apr 2021 00:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618470582; cv=none; d=google.com; s=arc-20160816; b=Cke7vo3ErAu+1gPa8Mvoa8W+qTGZy29h/LE2q5nD3vaL12hWg9uXS57tfuZ/sWCCHA 4GoF+xTub/HtiudpcVKpuLURV38sPpLT0YdfuFHCPF0tFoU5/N/dzPjGT0ojcBjRRxY4 a+f2b4Jb34kQUl3Rq9mVA7RG/1j1NOk+VHtYCSNBPJzr9BXX1X+gDejiAr/bbH2eTP9j QR8E5ij3PUszI+NJPRKbnv/NmSmsMX+VMIIfyBAog0jmxKON1BZ6roytuGj3GhYNb/50 mN2x7+nNC1nzKVfvQ8Fpaj7wSHZDaGxRMBfalGagF4fSeF49nSYgDppXhD9NKfPGcVdd z8dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nOLV/Oy9dMUzuTuhuv9iYZGKpUTv1tQoggqmfp9NMG0=; b=EqlFpnG438MinLHDCvxDKwgweijhwgaYHAB1wnFPWf/nGHQS7miEOP4AMGvUiTsSst o/ANGNnSFLhDOtLbqIXlALvwdoR6Kg6MHw0zDBRHgB2UCkpjNp2IxAUTlmEPNfPutkUX mP9VYNMjJYyNY2ibONoxxImokvnwNhDbDMZEVt+dXRUL0IAztdTI9FInRST76bHDVlrn SY5Zhp0YUDtL1bTkoIEqDkUjme94XVab1kp/dw1cWjFdLH4QfemylZ6ROcyNEnnSQSJR GmiTsQLvbJeglpsZEVQdKxJHREwXg1BlAlho/7DHq2rDUQQ+iIjtcOywE+84GdX4iNaI hl/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XHGBcj3h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si2163152pgl.294.2021.04.15.00.09.28; Thu, 15 Apr 2021 00:09:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XHGBcj3h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230118AbhDOHI5 (ORCPT + 99 others); Thu, 15 Apr 2021 03:08:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:44322 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbhDOHI4 (ORCPT ); Thu, 15 Apr 2021 03:08:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1618470513; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nOLV/Oy9dMUzuTuhuv9iYZGKpUTv1tQoggqmfp9NMG0=; b=XHGBcj3hBO+MfNOihzVvmuEuljVs10StZmWDsrrX0tWmfIs9xfhJt/xRK5LXm8UDnMdMfj Gw43B1ylwVv3quvDI3TC+YcYcGGXGlVVPRoKKp69lMnpLSBRxg3u1HfjUD1K3GJVkDcQwD s88Q+PYfS6rt8uzZm4YIIvmYuRNIdeY= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 51A6CB035; Thu, 15 Apr 2021 07:08:33 +0000 (UTC) Date: Thu, 15 Apr 2021 09:08:32 +0200 From: Michal Hocko To: Johannes Weiner Cc: Muchun Song , guro@fb.com, akpm@linux-foundation.org, shakeelb@google.com, vdavydov.dev@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, fam.zheng@bytedance.com Subject: Re: [External] Re: [PATCH 4/7] mm: memcontrol: simplify lruvec_holds_page_lru_lock Message-ID: References: <20210413065153.63431-1-songmuchun@bytedance.com> <20210413065153.63431-5-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 14-04-21 13:49:56, Johannes Weiner wrote: > On Wed, Apr 14, 2021 at 06:00:42PM +0800, Muchun Song wrote: > > On Wed, Apr 14, 2021 at 5:44 PM Michal Hocko wrote: > > > > > > On Tue 13-04-21 14:51:50, Muchun Song wrote: > > > > We already have a helper lruvec_memcg() to get the memcg from lruvec, we > > > > do not need to do it ourselves in the lruvec_holds_page_lru_lock(). So use > > > > lruvec_memcg() instead. And if mem_cgroup_disabled() returns false, the > > > > page_memcg(page) (the LRU pages) cannot be NULL. So remove the odd logic > > > > of "memcg = page_memcg(page) ? : root_mem_cgroup". And use lruvec_pgdat > > > > to simplify the code. We can have a single definition for this function > > > > that works for !CONFIG_MEMCG, CONFIG_MEMCG + mem_cgroup_disabled() and > > > > CONFIG_MEMCG. > > > > > > Neat. While you are at it wouldn't it make sesne to rename the function > > > as well. I do not want to bikeshed but this is really a misnomer. it > > > doesn't check anything about locking. page_belongs_lruvec? > > > > Right. lruvec_holds_page_lru_lock is used to check whether > > the page belongs to the lruvec. page_belongs_lruvec > > obviously more clearer. I can rename it to > > page_belongs_lruvec the next version. > > This sounds strange to me, I think 'belongs' needs a 'to' to be > correct, so page_belongs_to_lruvec(). Still kind of a mouthful. > > page_matches_lruvec()? > > page_from_lruvec()? Any of those is much better than what we have here. -- Michal Hocko SUSE Labs