Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10351074rwl; Mon, 2 Jan 2023 00:35:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXvClV6mVLd5xsNWBY+eHWKH3YFUzCnZFCYb9BIC/3BtEzFsCrh2xVUxtOr9V/ou7BBBa4Al X-Received: by 2002:a17:906:6b96:b0:7c1:4bb2:f62b with SMTP id l22-20020a1709066b9600b007c14bb2f62bmr34322031ejr.27.1672648512041; Mon, 02 Jan 2023 00:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672648512; cv=none; d=google.com; s=arc-20160816; b=pxGzglnBhp+I8f9jDdQVuYHaugx0VLZOY8i8sVqYnxwfSWmDv+fAVZYvhgZshK00A/ DqVGMZOZ8ZdiQI99S8qz40vUPcIatCUhRNsDJsD+d7FcahKwMHqHG0FXY/RR3qise3tt TpYM+6O72gzb10eLM40GaF4l5o2uzcn0picfZpqANa4PaCdqaCS3Xi9KCS4EyyjjX9vW lFlM6z1eIvFnGbha6HDG+52keDHVUc8gcpydQ0qFb46GLUaBWn6qHHH9WLkty2Rqr/yV 1yyh5eOwzkw/cv/alYUT5+rfs1dhjn75n5y/PlF1IuBWZBvtfUnjYKs/QzAZqIgexz6J WIbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=H75DFi9ruBZtmFkVkdPw0eEU2taX9Gg8XsLbPaQHEe4=; b=e3rLCbP3VcBTrUj2oQZuy4zp1r6jbgd78e3s4d7SGrwWRQxaAWlk4yWKnoRmF5kpei 1PUpRGxJTiKJ3Kfk1q6tLQ7xbMZm5i23JNyBBaF5A5NA5PRp2LX416LkUgqSoO14/HKC i/8QFnyE4pSP03cX/Njms53ZUZED6QdliIKujxYRs/5T2HnRFQ2RYzK9uNy5AmYMXe3F fPrj+Fz1BhbZvmBU1R3ySBM3jAniRjoFvaFwKX9XEx9DreN5+Dm2Ur0CS7VyJwgXwU6Y +W3Xvv14Fys1yz2OO82MgfuAsm0SS1jUwLU5SLElIFlq5GV8ljoc6PoSpIJ2dyRFMDLg iqKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=MJPFsj0L; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd9-20020a170907628900b0084c8ac6e0b2si10575188ejc.109.2023.01.02.00.34.57; Mon, 02 Jan 2023 00:35:12 -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=@suse.cz header.s=susede2_rsa header.b=MJPFsj0L; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231905AbjABIc2 (ORCPT + 58 others); Mon, 2 Jan 2023 03:32:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjABIcU (ORCPT ); Mon, 2 Jan 2023 03:32:20 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BF2AC03 for ; Mon, 2 Jan 2023 00:32:18 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0F5AC20897; Mon, 2 Jan 2023 08:32:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1672648336; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H75DFi9ruBZtmFkVkdPw0eEU2taX9Gg8XsLbPaQHEe4=; b=MJPFsj0LM8oWnteJyW53u4CUKbsexOFgRTQV04ifwTmDySriYHMPDcHzvliisBgcGLUAws SEnnKOo1R4BpiYbwI4kA9M2U7bNT5jvoSXF5OEBZ0CabhUxNWZyRqfBlHP7k5t8n0tbl5c omMLmC4YweurOobMfALepySs0VpDzOs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1672648336; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H75DFi9ruBZtmFkVkdPw0eEU2taX9Gg8XsLbPaQHEe4=; b=TTQVax9agQi/0O0uIYCs4wv2f1250O6kked2hT2h/6j9UVQjlkSPohT5egknrZSKUmbTSe kU26ydWBmJrQjTAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D75FC139C8; Mon, 2 Jan 2023 08:32:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id /JJuM4+WsmMPJQAAMHmgww (envelope-from ); Mon, 02 Jan 2023 08:32:15 +0000 Message-ID: <7fb9b7cc-5c07-4b30-fa5e-6146b402f73f@suse.cz> Date: Mon, 2 Jan 2023 09:32:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [patch] mm, slab: periodically resched in drain_freelist() To: David Rientjes , Andrew Morton , Christoph Lameter , Pekka Enberg , Joonsoo Kim Cc: Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: Content-Language: en-US From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=ham 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 12/28/22 07:05, 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 Thanks, added to slab/for-6.2-rc3/fixes > --- > 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;