kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: jim.cromie@gmail.com
To: Greg KH <greg@kroah.com>
Cc: kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: opaque "pointer" API, model, best practice ?
Date: Wed, 14 Oct 2020 09:45:21 -0600	[thread overview]
Message-ID: <CAJfuBxwAn1y1Mub6LokwLq0Sbtn7u0rd+6kAt3Lh67Fro_6P-w@mail.gmail.com> (raw)
In-Reply-To: <20201014152150.GA3764480@kroah.com>

On Wed, Oct 14, 2020 at 9:21 AM Greg KH <greg@kroah.com> wrote:
>
> On Wed, Oct 14, 2020 at 09:09:11AM -0600, jim.cromie@gmail.com wrote:
> > hi all,
> >
> > is there an api / usage model / or best practice
> > for opaque "handles" ?
>
> "it depends" :)
>
> What are you wanting to do exactly?
>
> > Im aware of 1 case:
> > the handle returned by zs_malloc
> > I have tried to use it, and have run into locking conflicts
> > when trying to keep the memory zs_mapped
> > longer than the duration of a function.
> > OTOH, if I map and unmap within the function, things work,
> > but this is unacceptable overhead.
> >
> > so I figure I should read some good code,
> > rather than keep hacking at bad code.
>
> Again, what are you trying to do?
>
> greg k-h

Im trying to put dynamic-debug metadata on a diet.

Ive split struct _ddebug into 2 (new part is struct -_ddebug_callsite)
with a pointer linking them (intialied by DECLARE_DYNAMIC_DEUG_METADAT)

The _callsite records have lots of redundancy in module, file,
function pointers,
so Im hoping rzram can compress that all away.

Ive managed to zs_malloc and copy the _callsite recs,
and to zs_map them in when executing pr_debug (and thereby ddebug_emit_prefix)
as long as I unmap immediately afterwards.

But if I try to keep the mapping for the next potential print,
things blow up, with a lot of lockdep complaints and a panic.

If I can make it work,
we can retire the new section I created for the _callsite data,
and reduce the ~160kb of table storage by 30%

Ive been meaning to send it to mm-linux, but havent yet de-cluttered it enough

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2020-10-14 15:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 15:09 opaque "pointer" API, model, best practice ? jim.cromie
2020-10-14 15:21 ` Greg KH
2020-10-14 15:45   ` jim.cromie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJfuBxwAn1y1Mub6LokwLq0Sbtn7u0rd+6kAt3Lh67Fro_6P-w@mail.gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).