Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5988662rwl; Thu, 29 Dec 2022 06:03:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXt+mB6tb0W6moAuyRv5ZtJaE9zKkkVSqFodFSHNBtJ2ZwxD0Ams9aFyGpe2P8yTT0DSqBIS X-Received: by 2002:a05:6402:3998:b0:46b:203:f388 with SMTP id fk24-20020a056402399800b0046b0203f388mr32131234edb.39.1672322620973; Thu, 29 Dec 2022 06:03:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672322620; cv=none; d=google.com; s=arc-20160816; b=G8dzkuWp3IhfUZvZSPGuJNIy2JwGUWfpbYw0Y0/zCiZR55ygtU//NQrL4OFx80rgSm KoQLsTnj8ljdJzFTZ2fS8C0I1Fj5pz6rAYDbd47a0Sg40wDDsGSIZLqeGIR4MUb3yFZd xMFC+Mow6wfCGjP4aRpFRH1Cg6DhSxDdNndRA9T/U0FTo+GNU7AaW9i7UcdjzB7R3dH1 wTxRiVUxET2IfNmTRXv/wH5YOyxT5NULmePddhURfTJFEv0v979Xtk58VtR9u+p/Bpqc 50u1w6Gn4ginVKGC/J7DzLEyZT1wh0bfvF4dS1C0hV7IJKjLdjeYdS39xnI7KmfPKuTr JJJA== 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=v5HPkp/bFHtlvqu2/9jRhTUPSjVDvmYX0Z0JICpgPF4=; b=BuqGGyrd72ZArZaEkF5onhXbdDbwWcjgMvfim+aIU9YKTIV8HVLYu6T0qwQhQq2xi+ ZyUqsIJAzyUP+E+1HskIbdnErk0g78prgJ865GNgemBNNcMitWOrntk23ECK0xyPK5va RRslaI0D1vwrJt0EwbIZFmhdUUjywrD6UBS4HBNu4r/jojYqhXOEGcHQ0a0Zlz6EMUGh LiBLlJcFws1tHPXtumUmrSCfxueQwDmEl7QrZJeLIJ+F22rShHMEe7D9Zoq7nKoyT2AI Ja3wWql4lEdVc2nHpjd0gspHpQQHmW9UKZAjAjUqnx+kC5IHD/d3MmRfbdFdxtUQUwVT iSrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="WFu/SR8Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020aa7d516000000b00485220caa05si8393839edq.597.2022.12.29.06.03.26; Thu, 29 Dec 2022 06:03:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="WFu/SR8Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231148AbiL2Nm2 (ORCPT + 61 others); Thu, 29 Dec 2022 08:42:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233653AbiL2Nlx (ORCPT ); Thu, 29 Dec 2022 08:41:53 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B867311C1F for ; Thu, 29 Dec 2022 05:41:44 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id u4-20020a17090a518400b00223f7eba2c4so18950771pjh.5 for ; Thu, 29 Dec 2022 05:41:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=v5HPkp/bFHtlvqu2/9jRhTUPSjVDvmYX0Z0JICpgPF4=; b=WFu/SR8ZQg4bvs/mrWjdnOB/Wz2Hq7FEggZ6qtDdUaH3RW37YntXntNMzjPxuJEZz1 bWXfmgfwr2pjRdqhtqhlh2rnan7W+xaAEybVXbumaqFNwc3FBXNSQc3pItIDGuoFQ6CP hFGnj5tnxjKsjyDi9+yxuaIPAG4dPpGYLJeT1IZZXDNvUpNXoK5Ni/IcVULmfe0QzYFL H/Rfzj/pI6Um4SsLjrCTtvovY8n5F3snqxXV5pR6wXTZamfBZ6gQ52XgmFh7gTibj2wX xQW4og84vn1ayRFb5A+Us/AMEbEI+6Ut2XhwHEt2A4zQV4o7WVQTlj4RGX05i5jcUPRB FtOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=v5HPkp/bFHtlvqu2/9jRhTUPSjVDvmYX0Z0JICpgPF4=; b=jnxWVlha+NzhGdwwLFp/Kmr6JgDjvY6B5WaO8EJfKWsaPcIpI6jhRJp0nDa48W4hX6 UHiLAZn8zmEC8XLr2lIanlgdRARiwuh+9xZqU3KwVQauzQSoKjWvCfM/eMzEJW958Ufp Isp/ZsI3+nWyfNSdDBFh31jnTUHvUx/DDBs/Da7OJTB8mTUam4VP8x1cAokaiFeV1Ggk nbqiCal7kDz1vl6k2aHpkM2jb5LVnLOCy3rVt0oceSzYqEtlJKf8x5adDlvCLy6dcDwd MrI2YpaCbZwmJk1q2238+nIVSa4UZ97wSEtWVZGCKP9GPEVt8NMtK+/vbVoSGAXuXohX NA+w== X-Gm-Message-State: AFqh2koTkrltdKSF1jMN9uyGftdTFQBt+GqMBu8xWyRJyJ0A+Cw1whtC oFDF2G1YjGL4bc9cxfa9BgY= X-Received: by 2002:a17:902:f68a:b0:192:49f4:fe67 with SMTP id l10-20020a170902f68a00b0019249f4fe67mr40899472plg.57.1672321304209; Thu, 29 Dec 2022 05:41:44 -0800 (PST) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id e9-20020a170902784900b001895b2c4cf6sm12830895pln.297.2022.12.29.05.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 05:41:43 -0800 (PST) Date: Thu, 29 Dec 2022 22:41:38 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: David Rientjes Cc: Andrew Morton , Christoph Lameter , Pekka Enberg , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch] mm, slab: periodically resched in drain_freelist() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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, Dec 27, 2022 at 10:05:48PM -0800, David Rientjes wrote: > drain_freelist() can be called with a very large number of slabs to free, > such as for kmem_cache_shrink(), or depending on various settings of the > slab cache when doing periodic reaping. > > If there is a potentially long list of slabs to drain, periodically > schedule to ensure we aren't saturating the cpu for too long. > > Signed-off-by: David Rientjes > --- > mm/slab.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/slab.c b/mm/slab.c > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -2211,6 +2211,8 @@ static int drain_freelist(struct kmem_cache *cache, > raw_spin_unlock_irq(&n->list_lock); > slab_destroy(cache, slab); > nr_freed++; > + > + cond_resched(); > } > out: > return nr_freed; Looks good to me, Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> -- Thanks, Hyeonggon