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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 A7C99C433E1 for ; Thu, 9 Jul 2020 15:55:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6CCCA2077D for ; Thu, 9 Jul 2020 15:55:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="Uc4CCtML" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CCCA2077D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D57446B0008; Thu, 9 Jul 2020 11:55:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0F3E6B000A; Thu, 9 Jul 2020 11:55:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCE5A6B000C; Thu, 9 Jul 2020 11:55:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0214.hostedemail.com [216.40.44.214]) by kanga.kvack.org (Postfix) with ESMTP id A2FA66B0008 for ; Thu, 9 Jul 2020 11:55:41 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 42FB18248D52 for ; Thu, 9 Jul 2020 15:55:41 +0000 (UTC) X-FDA: 77018987682.16.hope87_4517c1126ec7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 3D5E2100E6912 for ; Thu, 9 Jul 2020 15:55:40 +0000 (UTC) X-HE-Tag: hope87_4517c1126ec7 X-Filterd-Recvd-Size: 5221 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jul 2020 15:55:39 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id y18so1430605lfh.11 for ; Thu, 09 Jul 2020 08:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=ko2toLCZVcB1lleYvRhScChtwEJOK0oSQV22Yurja2Q=; b=Uc4CCtMLCs3lO9xhdmBONzGWRiRwT9i1ZMePGIYt4l0xaGLYpohw0IerOblGgyhLoW AT5UmJkwwuxoQRcctui1mXrBp211sfFdtr7d5kPb5DLJKl327ienkkdxSaj8OuYdeb0V gD1sYjx5U1/q4X6Lx2NbhLKuVFaBneMzUK5o+BllCwhWYGnXAbgfroWFhQSbqErEmWDK +AP91wv6In/CR0I+dXAnClibT5z9pp3YulfddtucRksexscSOh1ki4NY5LEcEYtJB1y0 5GdX3YRnyOvUjqVkLqhHFf5V1TWpqXAIYide9TRITdEoQ58rlC8+trgvboocTbHdQGcQ dI4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=ko2toLCZVcB1lleYvRhScChtwEJOK0oSQV22Yurja2Q=; b=gC2CzAilwwZj/U3IIe1CUk/JA+24DUoqM8J9vHxLNPXWQPRXYQGzCwnWct0teLj1g1 XEODLUsdJJaLp+cwoqHuXc28qsuxQywhyY7Q6u2CcGOqRRmTg4BI0e26WXWtDlDpT6Ac EpFdfs2fMMkf9cXaF4SWWkOUFcPc2F7+QX5htRPo0gvxNjXSycZI15yJJy/EQu+kfjHA AQg5cpslM6aAQu801zt2QargDSB0MZd7x54xYf0LUcF8/7qVEdi8xTYl77bUmCFq8ypb G4/TfOwelMywbT2LP0LqL2sB+sr1hVZ2XB+X/c3mkM8F1AW+ppj2ikkX7MPypIVRz33K d+2Q== X-Gm-Message-State: AOAM532YlWjeS9qj7RaeLXqwHSWx3VLGb48bzBhd+gf06l6Ti7+kAcE+ VSX022nws5oVzVSG5OA6OlR3LA== X-Google-Smtp-Source: ABdhPJz4tCeIwbs8YS4yldpnaa+nxdD/inUHg/Ru6+3qcswHKG+9xwpsXiqVxAdhy33UuaZPpmiZ1Q== X-Received: by 2002:a05:6512:250:: with SMTP id b16mr39400876lfo.67.1594310137811; Thu, 09 Jul 2020 08:55:37 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id q21sm933168ljj.67.2020.07.09.08.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 08:55:37 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id BD87510222B; Thu, 9 Jul 2020 18:55:38 +0300 (+03) Date: Thu, 9 Jul 2020 18:55:38 +0300 From: "Kirill A. Shutemov" To: Alex Shi Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, yang.shi@linux.alibaba.com, willy@infradead.org, hannes@cmpxchg.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com Subject: Re: [PATCH v15 05/21] mm/thp: move lru_add_page_tail func to huge_memory.c Message-ID: <20200709155538.mf3gxutgckz7p67i@box> References: <1594122412-28057-1-git-send-email-alex.shi@linux.alibaba.com> <1594122412-28057-6-git-send-email-alex.shi@linux.alibaba.com> <9fa2cf92-c4a0-02ca-1f02-7ef71952de18@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9fa2cf92-c4a0-02ca-1f02-7ef71952de18@linux.alibaba.com> X-Rspamd-Queue-Id: 3D5E2100E6912 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: On Tue, Jul 07, 2020 at 08:00:11PM +0800, Alex Shi wrote: >=20 >=20 > =E5=9C=A8 2020/7/7 =E4=B8=8B=E5=8D=887:46, Alex Shi =E5=86=99=E9=81=93: > > =20 > > +static void lru_add_page_tail(struct page *page, struct page *page_t= ail, > > + struct lruvec *lruvec, struct list_head *list) > > +{ > > + VM_BUG_ON_PAGE(!PageHead(page), page); > > + VM_BUG_ON_PAGE(PageCompound(page_tail), page); > > + VM_BUG_ON_PAGE(PageLRU(page_tail), page); > > + lockdep_assert_held(&lruvec_pgdat(lruvec)->lru_lock); > > + > > + if (!list) > > + SetPageLRU(page_tail); > > + > > + if (likely(PageLRU(page))) > > + list_add_tail(&page_tail->lru, &page->lru); > > + else if (list) { > > + /* page reclaim is reclaiming a huge page */ > > + get_page(page_tail); > > + list_add_tail(&page_tail->lru, list); > > + } else { > > + /* > > + * Head page has not yet been counted, as an hpage, > > + * so we must account for each subpage individually. > > + * > > + * Put page_tail on the list at the correct position > > + * so they all end up in order. > > + */ > > + add_page_to_lru_list_tail(page_tail, lruvec, > > + page_lru(page_tail)); >=20 >=20 > I missed some points for this function, since in the call chain: > split_huge_page() to lru_add_page_tail, the head page's lru won't be > set when !PageLRU(head). But the other page_tail are add to lru list he= re > Is it ok for this situation? It doesn't differ from the situation when some pages are isolated from LRU. Tail page has become completely on its own after __split_huge_page_tail() has completed, it's not tied to the head page. --=20 Kirill A. Shutemov