From owner-svn-src-head@freebsd.org Thu Nov 12 22:12:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0553D4661F0; Thu, 12 Nov 2020 22:12:38 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXG796LyTz4pgX; Thu, 12 Nov 2020 22:12:37 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-oi1-x229.google.com with SMTP id j7so8164589oie.12; Thu, 12 Nov 2020 14:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hZ44B0PGqFtPHTBcc9vPRRZ21qSno4Fe8YS1vFXzn8I=; b=fL+ktIOv9iwotnH/fqnvZwf1FpKxo9lP5rBRKmkFbEQw5zpijrZ8jkTJaGfn84tPFS wKOKOeHnLP743k+Up13fpG9wNVPMkRArmeFFxREdlNfB5UGp8HV+Az7PAkX0BzCXaLDe LA9oLqOzvjfn5x10tnd1ldTYccvXdM2TBIcgebyr2L566MQAW7XA+Vpg4wmR4jgGQUVI TEQR5SX2E8XyT1Ibouz4xuS7e5OuV0cPvjQnnNFvkBWYnrqDbOCZnNAKzqpLstMmmkKN 5CKfdrA1Wj5iHxoONjrLXWZWseo/NkGBizM1BaYUKhHz0x5TV08rt1FrSraCLXRw7lN9 uFZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hZ44B0PGqFtPHTBcc9vPRRZ21qSno4Fe8YS1vFXzn8I=; b=LvNLYnfipLph6DWRPOzu5LXVQ7wiwpbKUQNMJwDf1kuBWuDa/STE+QG1AiEZmRvjtq IOhVbtaX8DWbU07JJXQ4IH/PZ5SoyXeC7O+uXFuWekOSA+uebg99IB3fRzm4LfKgSo/2 ezTLXiLScpcpPBLGKOlZGEhkBtKs4YxvwEKP5rLI9mjbrU1VU6pgQ2Ws1QBnS30+33+3 IUe4xznUwLlsIJixm7jPgdBUK8b2z1eskFs3wNIsG0CeyLCvfTK57dabwZwGS3MtXPyO 5TrxU4uM8dZ0kouRSELNqFl8UEyHPs2r+eYyIR4bJzsFfBdSGfXDPDnNVvyGj07MLznc VeXg== X-Gm-Message-State: AOAM53397hZrr66D9dNIRwzq+iUf3hgDHb//gw8WEJxXy+tAWattwZ0x GNCHvVbvKOZVJmOMplkk5V+pL/8S7xV67I08XfLaFndN X-Google-Smtp-Source: ABdhPJxQgvTKV9tbgZx/W6P1soOubuYDxGb1pBtI6wLmkNCKfzHzX6VVVpOZxLWvhTu5ZaajSt/C0t4vjkCgGBpnk/E= X-Received: by 2002:aca:ef06:: with SMTP id n6mr1186831oih.173.1605219156393; Thu, 12 Nov 2020 14:12:36 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a4a:c689:0:0:0:0:0 with HTTP; Thu, 12 Nov 2020 14:12:35 -0800 (PST) In-Reply-To: <202011122020.0ACKKvFa090942@repo.freebsd.org> References: <202011122020.0ACKKvFa090942@repo.freebsd.org> From: Oliver Pinter Date: Thu, 12 Nov 2020 23:12:35 +0100 Message-ID: Subject: Re: svn commit: r367626 - head/sys/geom/bde To: Mateusz Guzik Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CXG796LyTz4pgX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 22:12:38 -0000 On Thursday, November 12, 2020, Mateusz Guzik wrote: > Author: mjg > Date: Thu Nov 12 20:20:57 2020 > New Revision: 367626 > URL: https://svnweb.freebsd.org/changeset/base/367626 > > Log: > gbde: replace malloc_last_fail with a kludge > > This facilitates removal of malloc_last_fail without really impacting > anything. > > Modified: > head/sys/geom/bde/g_bde_work.c > > Modified: head/sys/geom/bde/g_bde_work.c > ============================================================ > ================== > --- head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:43 2020 > (r367625) > +++ head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:57 2020 > (r367626) > @@ -77,6 +77,20 @@ > #include > #include > > +/* > + * FIXME: This used to call malloc_last_fail which in practice was almost > + * guaranteed to return time_uptime even in face of severe memory > shortage. > + * As GBDE is the only consumer the kludge below was added to facilitate > the > + * removal with minimial changes. The code should be fixed to respond to > memory > + * pressure (e.g., by using lowmem eventhandler) instead. > + */ > +static int > +g_bde_malloc_last_fail(void) > +{ > + > + return (time_uptime); > +} > + Previously malloc_last_fail returned a relatively small number - if i read the code correctly: -int -malloc_last_fail(void) -{ - - return (time_uptime - t_malloc_fail); -} - > static void g_bde_delete_sector(struct g_bde_softc *wp, struct > g_bde_sector *sp); > static struct g_bde_sector * g_bde_new_sector(struct g_bde_work *wp, > u_int len); > static void g_bde_release_keysector(struct g_bde_work *wp); > @@ -210,7 +224,7 @@ g_bde_get_keysector(struct g_bde_work *wp) > g_trace(G_T_TOPOLOGY, "g_bde_get_keysector(%p, %jd)", wp, > (intmax_t)offset); > sc = wp->softc; > > - if (malloc_last_fail() < g_bde_ncache) > + if (g_bde_malloc_last_fail() < g_bde_ncache) > g_bde_purge_sector(sc, -1); And in this case, the semantic change renders all of these calls from alway true to always false expression. > > sp = TAILQ_FIRST(&sc->freelist); > @@ -228,7 +242,7 @@ g_bde_get_keysector(struct g_bde_work *wp) > if (sp->ref == 1) > sp->owner = wp; > } else { > - if (malloc_last_fail() < g_bde_ncache) { > + if (g_bde_malloc_last_fail() < g_bde_ncache) { > TAILQ_FOREACH(sp, &sc->freelist, list) > if (sp->ref == 0) > break; > @@ -311,7 +325,7 @@ g_bde_purge_sector(struct g_bde_softc *sc, int fractio > if (fraction > 0) > n = sc->ncache / fraction + 1; > else > - n = g_bde_ncache - malloc_last_fail(); > + n = g_bde_ncache - g_bde_malloc_last_fail(); > if (n < 0) > return; > if (n > sc->ncache) > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >